aws-samples/aws-serverless-openai-chatbot-demo

Reopening Closed Issue.

Closed this issue · 4 comments

dfrho commented

Earlier issue was closed without fixing. API Gateway after deploying still getting this auth error after removing the backslash in Principal property in bucket policy. Thanks for sticking with me on this.

Access to fetch at 'https://3cncgd7ya0.execute-api.us-east-2.amazonaws.com/login' from origin 'http://bucket-name99.s3-website.us-east-2.amazonaws.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. POST https://3cncgd7ya0.execute-api.us-east-2.amazonaws.com/login net::ERR_FAILED 404

image

did you change the cors settings of api gateway?
image

dfrho commented

yes, definitely.

dfrho commented

Thanks much. I'm noticing this linting error in the code but not sure how to fix it: Parsing error: Unexpected token =>eslint

Noticing there's an async but no await?

Screen Shot 2023-02-25 at 7 59 26 AM

Also the error suggests adding a no cors to the request. Would that help?

This functon is invoked by AWS Lambda, which uses an async handler as default. And the syntax of this file shoud be fine, it works in Lambda.