aws-toolkit-vscode icon indicating copy to clipboard operation
aws-toolkit-vscode copied to clipboard

Cannot find template file when debugging in vs code

Open ABlackPenny opened this issue 2 years ago • 3 comments

Describe the bug I was trying to debug AWS LAMBDA locally in vs code, but I always get the 'Invalid (or missing) template file (path must be workspace-relative, or absolute):' when I run the debug

To reproduce

1.Add new file named as template.yml, copy and paste from serverless.yml to template.yml 2. Click on 'AWS: Add debug configuration' 3. open the launch json, add the payload 4. See error : Invalid (or missing) template file (path must be workspace-relative, or absolute): e:\companyNameWork\XXX-api\template.yml

Expected behavior The debug function would run and has some output in debug console just like other project's done before.

Screenshots 417adf0871ca9df2da5d085a5dbefda

faa738c770de91d0a46ad5bad2850a0

Your Environment

  • OS: win10
  • AWS Toolkit version: AWS Toolkit v1.37.0
  • SAM CLI version: SAM CLI, version 1.40.0

Additional context

  1. In same conputer, with same process and IDE(vs code), other project could use AWS Toolkit debug perfectly.
  2. I have tried absolute path and relative path, doesn't work. 3.Tried rebuild the template.yml 4. Tried reopen the IDE 5. Tried reopen the computer 6. The API has been deployed and could work

ABlackPenny avatar May 03 '22 05:05 ABlackPenny

This means that somehow our file watcher isn't finding the file. Can you check the logs (remove private info)?

  1. In VSCode settings, ensure that "aws log level" is "debug".
  2. Perform the steps to reproduce the issue.
  3. Use the AWS: View Toolkit Logs command to get the logs.

Is the file path mentioned in the logs?

justinmk3 avatar May 03 '22 15:05 justinmk3

This means that somehow our file watcher isn't finding the file. Can you check the logs (remove private info)?

  1. In VSCode settings, ensure that "aws log level" is "verbose".
  2. Perform the steps to reproduce the issue.
  3. Use the AWS: View Toolkit Logs command to get the logs.

Is the file path mentioned in the logs?

Hi justinmk3, Thanks for your reply and help.

  1. I changed the log level to 'verbose'
  2. I deleted the current '.vscode' and template.yml
  3. I redo the same process like I did before.

This is what I got in log. And I think the file path mentioned in the log. 微信图片编辑_20220504110134

ABlackPenny avatar May 04 '22 01:05 ABlackPenny

related: #2613

justinmk3 avatar May 04 '22 21:05 justinmk3

AWS Toolkit 1.96 includes a potential fix for this issue. https://github.com/aws/aws-toolkit-vscode/pull/3946

Logging was also improved, so if the issue still occurs with 1.96, posting the logs will be helpful. Thanks!

justinmk3 avatar Oct 27 '23 11:10 justinmk3