Link to chapter - http://serverless-stack.com/chapters/handle-api-gateway-cors-errors.html
It seems like this chapter is accidentally being skipped in your tutorial.
Clicking ‘next’ from What is Infrastructure links to Configure DynamoDB. The DynamoDB chapter’s serverless.yml Resources section references
resources/api-gateway-errors.yml. I think What is Infrastructure should link this chapter instead, and this chapter’s ‘next’ should link to DynamoDB.
By the way, this tutorial is excellent, thank you.
Oh this chapter is a new addition to Part 1 of the tutorial. Did you by any change complete Part 1 some time ago?
Oh, interesting, I see what you mean. When I worked through the tutorial, it had me going into API gateway and manually setting this up. I have been focused on just the infra as code section recently, which assumes
resources/api-gateway-errors.yml is already hooked up correctly.
So far the tutorial has been wonderful. I’m now splitting up my apis into separate services following your tutorial as it hit the 200 limit error yesterday! (something similar to serverless-stack-demo-mono-api but the db and auth will be separate repos). Wondering where to include the API Gateway errors resource in this architecture? Couldnt find anything related to this in your github sample.
Sorry which API Gateway errors resource are you talking about? Is it this one - https://github.com/AnomalyInnovations/serverless-stack-demo-api/blob/master/resources/api-gateway-errors.yml?
If that is the case then you should be able to reference it just as before.
Thanks for your reply. Yes that’s the resource I was referring to. If there are more than one services, should each service refer this api gateway errors resource? I guess it should! Just wanted to confirm.
So this isn’t super obvious but this errors resource is tied to a API Gateway project. In the case of the serverless-stack-demo-mono-api, we add all our APIs to the same project. So we only need to have this resource once. We talk about using the same project at the bottom of this chapter:
Have you ever had some requests working and some failing with CORS issues targeting the same backend? I’m having this weird thing happening:
- my requests go through except for one with query string parameters
- this one request works in chrome but not firefox
- in firefox, I get a vague network error and the browser logs that cors failed (Reason: CORS request did not succeed)
I’ve asked my question there but didn’t get much luck: https://forums.aws.amazon.com/thread.jspa?messageID=891922&tstart=0#891922
I’ve not had that specific issues but we do have a few requests fail every once in a while.
From reading your issue it seems like you are able to replicate it consistently. Can you put your code up in a repo?