-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Can't debug using vscode v1.25, Unable to open 'index.js': File not found #555
Comments
I have the same problem using the latest version of vscode. Linux Ubuntu |
I'm also experiencing this problem as of this morning.
|
Is this only with the latest version of VSCode? Did this work in the previous 1.24 version? Trying to narrow down the search field here but the comments suggest something in 1.25 changed. |
yes, it is working in the previous version 1.24 so the problem only occurs in the latest version of VSCode. |
So my recommendation is to stay a version behind (if you can) until we can track what VSCode did to break the CLI. |
Same problem here on MacOS Sierra with |
Something similar happens for Node.js |
I don't know if my observation is related to this issue but here is it anyway: |
I also would like to add a walk-around. If, in launch.json, both "localRoot" and "remoteRoot" is properly set, especially "localRoot" is set as the root of the source, corresponding to the "codeUri" property in template, you can just set a breakpoint in the code, ignore the error message (although a bit of annoying to see it there) and press F5 or click the Continue (play) button, and execution will pause at the breakpoint and you can trace your code. It's just you cannot trace what's inside the code from that "awslambda/index.js". For example, in the example project I'm working on, "CodeUri: src/" is in "template.yaml" in the properties of the lambda function, and "localRoot": "${workspaceRoot}/src" is in the launch.json to match the codeUri. Or, if breakpoint does not work, you can still use the "debugger" statement to break the execution. |
@bingtimren workaround works for me
another workaround is use |
I have upgraded to v1.26 and still same issue |
I'm having this same problem with v.1.27 |
This was the setting, under which I was able to get it to work. VScode needs to be open at the sam-app level. I'll have a PR out for this soon. |
We have updated the documentation to reflect the correct mechanism to launch vscode debugging. |
could you provide updated document link? |
Description:
I'm trying to debug a lambda with sam cli. It starts up the docker container, and then waits for me to attach a debugger. When I try to attach, vscode pops up a warning:
Unable to open 'index.js': File not found (file:///c:/Users/esty.heller/Documents/Dev/benmanagesoftware/lambda/runtime/node_modules/awslambda/index.js).
And then it just stops and waits, can't do anything except disconnect and let the function run.
Just running the function with sam local invoke works fine.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Windows 10, Docker version 18.03.1-ce, build 9ee9f40 (using linux containers), latest vscode
Output of
sam --version
:SAM CLI, version 0.4.0
Optional Debug logs:
At this point, I try to attach using my launch config:
And I get a popup warning
Unable to open 'index.js': File not found (file:///c:/Users/esty.heller/Documents/Dev/benmanagesoftware/lambda/runtime/node_modules/awslambda/index.js).
and it won't attach.Here is my template.yaml
Here is the create-url.js
and here is event-create.json
Add --debug flag to command you are running
The text was updated successfully, but these errors were encountered: