Aws-toolkit-jetbrains: Lambda Debugger takes me to _pydev_execfile.py and crashes

Created on 25 Jun 2020  Â·  9Comments  Â·  Source: aws/aws-toolkit-jetbrains

Describe the bug
I have been using AWS Toolkit for Pycharm for a couple months now. I'll set a breakpoint in my code and press debug and get taken to the breakpoint. It was working great last night but today I tried picking up where I left off and ran the exact same code again in debug mode and was taken to a file _pydev_execfile.py where a breakpoint was set on the line

exec(compile(contents+"\n", file, 'exec'), glob, loc)

now I tried running multiple other functions in debug mode and they're all throwing the same error. I've run all these functions lots of times before today and they've always worked.

To reproduce

  1. Set breakpoint in Lambda function
  2. Debug function
  3. Crash

Expected behavior

  1. Set breakpoint in Lambda function
  2. Debug function
  3. Taken to breakpoint

Screenshots
_pydev_execfile.py
my function

Your Environment

  • OS: macOS Catalina 10.15.4
  • JetBrains product: Pycharm
  • JetBrains product version: 2019.3.5
  • AWS Toolkit version: 1.16-193
  • SAM CLI version: 0.51.0
  • JVM/Python version: 3.8

Additional context
It looks like there is an error in _pydev_execfile when trying to import sys.
I'm also using Layers, recently I installed the requests module onto my layer and I think that is what may have broken it although it worked once when I ran it with the requests module.

blocked bug sam

Most helpful comment

Sam cli needs to be updated to deal with new lambda runtime. https://github.com/awslabs/aws-sam-cli/issues/2069

All 9 comments

UPDATE: I upgraded to

  • JetBrains product version: 2020.1.2
  • AWS Toolkit version: 1.16-201

Now the error shows up in the debug console rather than taking me to the breakpoint in _pydev_execfile.py
image

Sam cli needs to be updated to deal with new lambda runtime. https://github.com/awslabs/aws-sam-cli/issues/2069

The Lambda runtimes have been rolled back (for now) – so this issue should be fixed. Hopefully SAM CLI will be ready when they update again

@mhart @abrooksv It's working now, thanks.

Hi I updated to SAM CLI 1.0.0 and this issue is popping up again. Then I tried rolling back to SAM CLI 0.51.0 and the issue persists.

OS: macOS Catalina 10.15.6
JetBrains product: Pycharm
JetBrains product version: 2020.2
AWS Toolkit version: 1.17-202
SAM CLI version: 1.0.0
JVM/Python version: 3.8

Rolling back won't work – the images have all been updated and the old code will no longer work – only SAM CLI 1.0.0 and later will work.

Are you sure you're running 1.0.0?

image

Is there a chance there's another version lying around that this plugin might be picking up? (I'm not familiar with how it looks for sam)

Does the same error occur if you debug from sam directly (without using Pycharm)?

Good call, I had installed the sam-cli using brew and pip at different times. I had the pip version upgraded but not brew, upgrading the brew version solved the issue. Thanks.

Was this page helpful?
0 / 5 - 0 ratings