Issue with debugger linebreak using pdb on `sls invoke local`

aws

#1

Hi! I’m trying to use pdb’s line break debugger inside a handler:

import pdb
# more imports here

def search(event, context):
    # do stuff here

    pdb.set_trace()

    # more stuff here

But once I invoke the function locally via $ sls invoke local -f search, I get the following trace:

Traceback (most recent call last):
  File "/usr/local/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/invoke.py", line 58, in <module>
    result = handler(event, FakeLambdaContext())
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/bdb.py", line 67, in dispatch_line
    if self.quitting: raise BdbQuit
bdb.BdbQuit

Hope you can help, thanks!


#2

Hello @adlersantos, have you been able to find a solution for this? I’m also interested by that solution.


#3

Actually, after manually setting a break-point with set-trace(), I did not encounter your issue…


#4

been having the exact same issue and i couldn’t ever rule out what’s happening. i did found a bit of help reading through your posts so thanks. but if you have any updates i would appreciate it a lot


#5

Hey! As @majorgilles mentioned, this issue should be gone in later versions of serverless. I’m currently using version 1.30.1 so kindly update yours if that helps.