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.

Can't see logs of Lambda@Edge

See original GitHub issue

Describe the bug

I am trying to create a prototype using this package. My serverless.yml looks like this

todosDB:
  component: '@serverless/aws-dynamodb'
  inputs:
    name: todos
    attributeDefinitions:
      - AttributeName: id
        AttributeType: S
    keySchema:
      - AttributeName: id
        KeyType: HASH
  region: us-east-1

dcrestiniMe:
  component: "@sls-next/serverless-component@1.19"
  inputs:
    build:
      env:
        DATABASE_URL: ${todosDB.name}
    runtime:
      defaultLambda: "nodejs14.x"
      apiLambda: "nodejs14.x"
      imageLambda: "nodejs14.x"
    region: us-east-1

When I deploy, everything seems fine and I can access the default route which renders absolutely fine. The DynamoDB is also created with no problem. In my app though, I have implemented a small todos API, which has 2 routes, a GET /api/todos and a POST api/todos/new, as well as a page /todos which fetches the todos (I call the function rather than using the REST endpoint) and renders them. My problem is that this function is not working, as I get back 503. When I go onto AWS Lambda, I can see the 3 lambdas being deployed and udpated but when I look at the logs to understand what’s wrong, it looks as if none of those Lambda are invoked. I can not understand why no logs are appearing would anyone be able to help?

Actual behavior

No logs are found in Cludwatch

Expected behavior

I would expect to see some logs that could help debug wha’ts going on

Steps to reproduce

Screenshots/Code/Logs

Versions

  • OS/Environment: Mac OS Sierra (although this issue happen on the Lambda, not my laptop)
  • @sls-next/serverless-component version: tested with 1.19.0 and 1.20.0-alpha.6
  • Next.js version: 10.2.0

Additional context

I have a checked in every single region of AWS and I have not been able to find logs anywhere. In the Dashboard of Lambda I can see that something is being invoked, but when I use “go to logs” nothing shows up

image

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 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
dphangcommented, May 23, 2021

The logs should be in same region from where you accessed the endpoint, since it is Lambda@Edge it is replicated to multiple CloudFront regions. Also ensure sure you are checking right function (there could be 3 for Lambda@Edge: one for API, default and image lambda). For example, I am in Seattle area, even though the Lambda would show as in us-east-1, but the Lambda@Edge logs would actually be in CloudWatch in the us-west-2 region (Oregon) since that’s closest to me.

0reactions
dphangcommented, Aug 1, 2021

Closing old issue - hopefully you were able to find the logs

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lambda@Edge not logging on cloudfront request
Now when I make a request through cloudfront, it must be logged in cloudwatch, but it doesn't. If I do a simple Test...
Read more >
Testing and debugging Lambda@Edge functions
For more information about testing in the Lambda console, see the Invoke the Lambda Function and Verify Results, Logs, and Metrics section in...
Read more >
No logs from JS console.log of Lambda@Edge in CloudWatch
Hi. I have a lambda edge function configured in my CF distro. The function is working, it is being executed, there are no...
Read more >
Edge function logs - Amazon CloudFront - 亚马逊云科技
Lambda @Edge automatically sends function logs to CloudWatch Logs, creating log streams in the Amazon Web Services Regions where the functions are run....
Read more >
lambda edge logs and invocation counts are not showing
When i hit the endpoint it's redirecting to the page where i want to redirect, according to my lambda. but i was not...
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