Hi all,
I am working the the Shopify admin API (API version: 2020-10) and i want to upload the product image using stagedUploadTargetGenerate. According to the documentation, i need to provide filename, mimeType and resource as input parameters and i used the following values:
const filename = '/u01/sony-vaio.jpg'; // Absolute path of the file to be uploaded
const mimeType = 'image/jpeg';
const resource = 'PRODUCT_IMAGE';
I made two requests and got the following response:
[
{
message: 'Internal error. Looks like something went wrong on our end.\n' +
'Request ID: 3f5edabf-6b18-4ed8-a04b-5d17c5b47c3c (include this in support requests).',
extensions: {
code: 'INTERNAL_SERVER_ERROR',
requestId: '3f5edabf-6b18-4ed8-a04b-5d17c5b47c3c'
}
}
]
[
{
message: 'Internal error. Looks like something went wrong on our end.\n' +
'Request ID: 552f4e6d-bc19-4ebd-ac6f-6d395f292ad2 (include this in support requests).',
extensions: {
code: 'INTERNAL_SERVER_ERROR',
requestId: '552f4e6d-bc19-4ebd-ac6f-6d395f292ad2'
}
}
]
I have contacted support and waiting for their repl. but in the mean time i want to check if there is anything i did wrongly. Here is part of my code for making the graphql request.
uploadImage: (auth, filename, mimeType, resource) => {
const query = {
query: `mutation stagedUploadTargetGenerate($input: StagedUploadTargetGenerateInput!) {
stagedUploadTargetGenerate(input: $input) {
userErrors {
field
message
}
url
parameters {
name
value
}
}
}`,
variables : {
input: {
filename: filename,
mimeType: mimeType,
resource: resource
}
}
};
return shopifyGraphQLClient(query, auth);
}
Any ideas are welcome. Thanks.