The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
See original GitHub issueDescribe the bug
In development my login and logout system works. In production it will always throw the error that is the title. Upon investigation with cloudwatch It revealed this subsequent error:
2021-03-16T12:34:42.147Z 4c0268ab-76ba-46e5-8a94-99a2a19586ce ERROR Invoke Error { “errorType”: “TypeError”, “errorMessage”: “Cannot read property ‘0’ of undefined”, “stack”: [ “TypeError: Cannot read property ‘0’ of undefined”, " at isOriginResponse (/var/task/index.js:6236:25)“, " at Runtime.handler$1 [as handler] (/var/task/index.js:5949:9)”, " at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)" ] }
My lambdas have been given full permissions and should have no trouble meeting permission requirements
These errors prevent the page from even loading, as the fetch is requested on page load.
Screenshots/Code/Logs
If applicable, here is my serverless configuration:
myNextApplication: service: evote component: “@sls-next/serverless-component@1.18.0” custom: defaultRegion: us-west-2 defaultEnvironmentGroup: dev provider: name: aws runtime: nodejs12.x stage: dev profile: evote inputs: domain: “evote.space” roleArn: “arn:aws:iam::Theresaproperroleherebutimexcludingitforsecurity” bucketName: “evote-serverless” build: env: USER_TABLE_NAME: Users
Versions
- OS/Environment: Linux Mint
- @sls-next/serverless-component version: @sls-next/serverless-component@1.18.0
Checklist
- You have reviewed the README and FAQs, which answers several common questions.
- Please first try using the most recent
latest
oralpha
@sls-next/serverless-component
release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.js
component and theserverless-next.js
plugin are deprecated and no longer maintained.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:15 (1 by maintainers)
Top GitHub Comments
Essentially I’m an idiot, don’t worry about it. 😂
Hey @mcnamara-charles,
Thank you again for the detailed response. I tried following your steps and it looks like it is not a permission issue but a Cloudfront caching/Lambda cold-start issue. Your suggestions and example have been quite helpful for my learning. I am going to create a separate issue for my problem. Thank you for all the help.