Troubleshooting AWS-SImage Upload: Fixing the Error and File Not Defined Issue

I tried to upload the image to aws-s3 bucket, and it return an URL which store my uploaded image (http://(aws-s3-bucket)/image.png). I then use the URL to act as the image parameter for CreateImageEdit and CreateImageVariation.

const image = returnURL;
response = await openai.createImageEdit(returnURL, prompt, undefined, 1, resolution);

But I get 400 error, I also used Buffer and it is not working either.
const buffer: Buffer = returnURL;
const file: any = buffer;
file.name = “image.png”;
const response = await openai.createImageVariation(file, parseInt(amount, 10), resolution);
In this case, File is not defined error.

Can someone identify where the mistake is? Thank you so much.