AWS API Gateway endpoint gives CORS error when POST from static site on S3

前端 未结 9 2412
予麋鹿
予麋鹿 2020-12-16 13:45

I have created an API endpoint with Serverless(serverless.com) which I expose through API Gateway. I\'m getting following error though I have enabled CORS from the

9条回答
  •  被撕碎了的回忆
    2020-12-16 14:02

    I am using AWS sdk for uploads, after spending some time searching online i stumbled upon this thread. thanks to @lsimoneau 45581857 its turns out the exact same thing was happening. I simply pointed my request Url to the region on my bucket by attaching the region property and it worked.

     const s3 = new AWS.S3({
     accessKeyId: config.awsAccessKeyID,
     secretAccessKey: config.awsSecretAccessKey,
     region: 'eu-west-2'  // add region here });
    

提交回复
热议问题