![]() While this did not fix my problem, this prompted me to dig around the dev tools a bit more. Regarding 3) It does NOT get a response, and in the console thats where there is logged the CORS error. Regarding 2) I do see the preflight OPTION method call in Chrome's dev tools network section. Regarding 1) I have verified the client code is making the POST method call to the correct API url. I have retried enabling CORS and redeploying a few times (as you mentioned in #3), since there is no state of CORS settings able to be viewed for a resource. when creating the POST method, the OPTIONS method appeared (As you mentioned happens in your #2). when enabling CORS in the API Gateway or 2. I should have mentioned that when either 1. In response to your suggestion to try to resolve the issue: They are not required to have any kind of behaviour configuration for api gateway. I would also suggest to clean all configuration which you did in cloudfront which you listed in point 2. eventually your code should get response.under dev console you should see preflight OPTION method call happening.Ensure you client code is making POST method call to.Test your website client code, check following You should see OPTION method added under /contact resource.Open again API Gateway and select /contact resource and re configure CORS, fill Access-Control-Allow-Origin as and save the changes. ![]() Please try following to see if it resolve your issue You have also enable CROS on your api gateway for this "POST" /contact method. ![]() you have a api gateway which you calling from your website javascript code and you getting CORS error.You are using S3 + CloudFront + Route53 for static website hosting.video titled: "Webinar: Dynamic Contact Forms for S3 Static Websites Using AWS Lambda, API Gateway & Amazon SES".AWS guide: create dynamic contact forms for s3 static websites using aws lambda amazon api gateway and amazon ses.Permissions/Roles, Established Roles and permissions per S3 bucket that holds the site contents, in permissions > CORS, I have the following JSON to allow a post of the contact form (notice no slash): [ The function code is: var AWS = require('aws-sdk') Lamda, set up a basic javascript function with default settings, the REST API is listed as a trigger, and does actually work as previously mentioned. The only thing I feel unsure about with API Gateway is after I enable the CORS, I can't seem to find a place where that setting has been saved, and if I click again on enable CORS, it is back to the default form ( with Access-Control-Allow-Origin: '')*Īmazon SES, set up 2 verified identities for sending/receiving emails via lamda. At the /contact - POST - Method Execution, The test works as expected (triggers Lambda func that uses SES to send email, which I do actually receive).Created a stage called "prod", ensured it had the /contact resource, and deployed.✔ Add Access-Control-Allow-Origin Integration Response Header Mapping to POST method ✔ Add Access-Control-Allow-Origin Method Response Header to POST method ✔ Add Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin Integration Response Header Mappings to OPTIONS method ✔ Add Access-Control-Allow-Headers, Access-Control-Allow-Methods, Access-Control-Allow-Origin Method Response Headers to OPTIONS method Clicked "Enable CORS and Replace existing headers".Access-Control-Allow-Origin: ' ' (no ending slash).For /contact, Resource Actions > Enable CORS:.API Gateway, Created a REST API with all default settings except:.Response headers policy - optional: CORS-With-Preflight.Origin request policy - optional: CORS-S3Origin. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |