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

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!

1 Like

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

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

been having the exact same issue and i couldn’t ever rule out what’s happening (maybe because i was focused on my site https://suppsforlife.to/category/pct/). anyway 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

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.

1 Like