question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.

See original GitHub issue

Describe 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

Checklist

  • You have reviewed the README and FAQs, which answers several common questions.
  • Please first try using the most recent latest or alpha @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 old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mcnamara-charlescommented, Mar 17, 2021

Essentially I’m an idiot, don’t worry about it. 😂

0reactions
tejasadvaitcommented, Mar 22, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Lambda function associated with the CloudFront ...
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions ; myNextApplication: service: ...
Read more >
Setting IAM permissions and roles for Lambda@Edge
IAM permissions required to associate Lambda@Edge functions with CloudFront distributions ... Allows the user to get configuration information for the Lambda ...
Read more >
CloudFront with Lambda@Edge: 503 The request could ...
... the erorr message The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
Read more >
Authorizing requests with Lambda@Edge
503 ERROR The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
Read more >
Untitled
</H2> <HR noshade size="1px"> The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found