App reviews, troubleshooting, and recommendations
I'm following the instructions in step 1 here to upload a video to a shop owner's store. I was able to get the parameters back from `stagedUploadsCreate` but when posting the file using form data I receive a `Service Unavailable` status 503 error.
Also wondering once I successfully get the video posted, will the `resourceUrl` be publicly available for the store owner to display the video in their storefront?
Here is the code I'm using to create and submit the form data:
const response = await fetch(
`https://${shop}/admin/api/2021-10/graphql.json`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": accessToken,
},
body: prepareVideoToUpload,
}
);
const responseJson = await response.json();
const target = responseJson.data.stagedUploadsCreate.stagedTargets;
const parameters = target[0].parameters;
const resourceUrl = target[0].resourceUrl;
const form = new FormData();
form.append(parameters[0].name, parameters[0].value);
form.append(parameters[1].name, parameters[1].value);
form.append(parameters[2].name, parameters[2].value);
form.append(parameters[3].name, parameters[3].value);
form.append(
"file",
fs.readFileSync(`files/${fileData.name}`),
`files/${fileData.name}`
);
// upload request
await axios
.post(target[0].url, {
body: form,
})
.then((res) => {
console.log("upload res: ", res);
})
.catch((e) => {
console.log("upload e: ", e);
});
I must have had wrong syntax somewhere, got the request to go through using the following code below.
However this now returns a 403 Forbidden error
const form = new FormData();
form.append(parameters[0].name, parameters[0].value);
form.append(parameters[1].name, parameters[1].value);
form.append(parameters[2].name, parameters[2].value);
form.append(parameters[3].name, parameters[3].value);
form.append(
"file",
fs.readFileSync(`files/${fileData.name}`),
`files/${fileData.name}`
);
// upload request
await axios(target[0].url, form, {
headers: {
...form.getHeaders(),
},
})
.then((res) => {
console.log("upload res: ", res);
})
.catch((e) => {
console.log("upload e: ", e.response);
});
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025