0

Trying my hands on with aws. I have done following.

Created a dynamodb table.

Created Chalice app to access the data through api.

Created a Angular6 application to do CRUD operation on the table using above api.

Everything worked fine when the angular app was on local. Now I uploaded my angular app on to S3, after that I am getting CORS error.

As per the documentation I did set the CORS Rules on s3 bucket but still the error persist.

Apart from S3 bucket do I need to set the CORS Rules somewhere else as well?

Error ScreenShot:

enter image description here

S3 bucket CORS Conf:

enter image description here

just10minutes
  • 583
  • 10
  • 26

2 Answers2

5

Setting the CORS on API gateway did not help, but setting the cors=True on the chalice app.py did help. As per the documentation they both are supposed to behave the same way, but in my case it did not help.

@app.route('/gsgl/update', methods=['PUT'],cors=True)

reference: https://github.com/aws/chalice#tutorial-cors-support

just10minutes
  • 583
  • 10
  • 26
0

Your application architecture is not evident form the questions.

However the error screen shot you have posted may hint at the fact that an API gateway is involved and You may need to enable CORS on the API gateway that you have created.

Yogesh_D
  • 17,656
  • 10
  • 41
  • 55
  • Hi Yogesh, I tried setting that from the console. But that did not solve the problem. But Now I set cors=True on my chalice app.py for all my routes that solved the issue. – just10minutes Aug 21 '18 at 11:52
  • You can answer your own questions, would recommend putting an answer in. And I would also recommend you understand what set cors=True does to the actual Infra structure that you created. – Yogesh_D Aug 21 '18 at 11:56
  • Sure Yogesh. Thank you for the suggestion – just10minutes Aug 21 '18 at 11:58