https://serverless-stack.com/ logo
#help
Title
# help
a

Artemiy Davydov

03/18/2022, 8:30 AM
Please add following to the documentation: 1) About caching functions. (After changing the function, at least 5 minutes must pass, otherwise you will not see the changes) 2) About bypassing circular dependencies 3) It is necessary to duplicate the CORS headers in the lambda function response (if it hasn't been mentioned anywhere else) It would have saved me 3 days of searching. I think it should help the others a lot too.
f

Frank

03/18/2022, 9:37 AM
Hey @Artemiy Davydov, thanks pointing it out! Lemme follow up on each:
1) About caching functions. (After changing the function, at least 5 minutes must pass, otherwise you will not see the changes)
Hmm.. the
Api
construct uses Api Gateway HTTP API. HTTP API does not support caching. Not sure what is caching here.
2) About bypassing circular dependencies
Will do! Opened an issue here https://github.com/serverless-stack/serverless-stack/issues/1549
3) It is necessary to duplicate the CORS headers in the lambda function response
Correct me if I’m wrong. CORS headers is only required for the
OPTION
request. You shouldn’t need to return CORS headers in ur Lambda functions for
GET/PUT/POST/DELETE
requests.
a

Artemiy Davydov

03/18/2022, 9:39 AM
1. I don't know, after adding this, I immediately received another response from the server
Copy code
axios.defaults.headers.common["Cache-Control"] = "max-age=0";
The headers from the
cors
property will only be present in preflight, as I understood
a

Adam Fanello

03/18/2022, 3:14 PM
Under API Gateway v1, we had to return CORS headers from our Lambdas. There's a middy.js middleware for this. API Gateway v2 (HTTP APIs) deals with CORS headers on its own.