Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot debug nodejs16 (node 16) lambda in local docker #3916

Closed
justinmk3 opened this issue May 27, 2022 · 3 comments
Closed

cannot debug nodejs16 (node 16) lambda in local docker #3916

justinmk3 opened this issue May 27, 2022 · 3 comments
Labels

Comments

@justinmk3
Copy link

justinmk3 commented May 27, 2022

Description:

Looks like index.js is missing in the nodejs Lambda image, and that is the expected entrypoint for local Docker-based Lambda debugging:

+ ["/var/runtime/index.js"],

docker run -it --entrypoint=bash public.ecr.aws/lambda/nodejs:16`
bash-4.2# cat /var/runtime/index.js
cat: /var/runtime/index.js: No such file or directory

Related:

Steps to reproduce:

sam build
sam local invoke --debug HelloWorldFunction --template template.yaml -d 5861

Try to attach a nodejs debugger to port 5861.

Observed result:

debugger fails to attach:

Error: Cannot find module '/var/runtime/index.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
27 May 2022 16:59:01,657 [ERROR] (rapid) Init failed error=Runtime exited with error: exit status 1 InvokeID=

Expected result:

can attach nodejs debugger.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macos
  2. sam --version: 1.50
  3. AWS region: n/a
@justinmk3 justinmk3 added stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. type/bug labels May 27, 2022
@justinmk3
Copy link
Author

as a workaround (or maybe it's the proper fix?) here is a PR for sam cli (as opposed to changing the Lambda image): #3913

@mingkun2020
Copy link
Contributor

Thanks @justinmk3 for submitting the issue, does the above fix working for this issue?

@mingkun2020 mingkun2020 removed maintainer/need-response stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels May 30, 2022
@mndeveci
Copy link
Contributor

mndeveci commented Jun 1, 2022

This is been released with SAM CLI v1.51.0

@mndeveci mndeveci closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants