"Invalid Image File"- Using GraphQL + AWS Lambda
Hi,
I'm trying to upload a simple "jpg" file and I'm seeing the error above.
A few things:
- the file is small (maybe 50kb).
- body is not base 64 encoded.
- Content-Type = multipart/form-data
This is what my function looks like:
export const uploadToCloudinary = (stream: Stream, folder: string, filePublicId?: string): any => {
const options = filePublicId ? {public_id: filePublicId, overwrite: true} : {public_id: `${folder}/${uuid()}`};
console.info(JSON.stringify(options));
return new Promise((resolve, reject) => {
const streamLoad = cloudinary.v2.uploader.upload_stream(options, (error, result) => {
if (result) {
resolve(result);
} else {
console.info(JSON.stringify(error));
reject(error);
}
});
stream.pipe(streamLoad);
});
};
Any idea what's happening?
Thanks,
Roni
-
Hi Roni,
The most likely explanation given the code above is if `stream` isn't encoded correctly, but it's hard to say for sure without seeing the full data or being able to see that request in our logs.
Are you able to share some specific information we can use to find the request on our side? cloud name, public_id, etc?
If you'd prefer not to share information like that here, you can also create a request for our support team directly using the form at https://support.cloudinary.com/hc/en-us/requests/new
Regards,
Stephen
Post is closed for comments.
Comments
3 comments