lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment
MIT License
5.83k stars 431 forks source link

Python debugging broken with new containers #289

Closed cnelsonvelo closed 4 years ago

cnelsonvelo commented 4 years ago

When attempting to debug using Pycharm today new containers were downloaded automatically and the debugging fails with this error:

Connected to pydev debugger (build 201.6668.115) Traceback (most recent call last): File "/tmp/lambci_debug_files/pydevd.py", line 1438, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/tmp/lambci_debug_files/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/var/runtime/bootstrap", line 4 if [ -z "$AWS_LAMBDA_EXEC_WRAPPER" ]; then ^ SyntaxError: invalid syntax

Reverting to an earlier version of the python3.8 containers, and preventing Pycharm from automatically updating them resolves the issue temporarily.

jeffgca commented 4 years ago

This seems to have broken AWS SAM cli as well.

matheuscanela commented 4 years ago

Same here File "/var/runtime/bootstrap", line 4 if [ -z "$AWS_LAMBDA_EXEC_WRAPPER" ]; then ^ SyntaxError: invalid syntax

matheuscanela commented 4 years ago

I moved to python3.7 for now and it is working.

matheuscanela commented 4 years ago

@mhart could you help us with that?

mhart commented 4 years ago

Well AWS Lambda did update a bunch of runtimes today – and the bootstrap files changed on them.

Unfortunately I'm not familiar with how Pycharm integrates these containers – is it expecting something in particular?

The python3.8 image seems to execute fine for me – without doing any complicated debugging or anything.

@therealjeffg can you be more specific about what broke with SAM CLI?

mhart commented 4 years ago

Yeah, this is an issue with aws-sam-cli – it's assuming that /var/runtime/bootstrap is a python file – but Lambda has changed it to be a bash file (hence the syntax error).

I'll file an issue over at the sam repo

mhart commented 4 years ago

Filed at https://github.com/awslabs/aws-sam-cli/issues/2069

mhart commented 4 years ago

Pull request opened at https://github.com/awslabs/aws-sam-cli/pull/2070

mhart commented 4 years ago

The Lambda runtimes have been rolled back – hopefully this won't raise its head again!