#ModuleNotFoundError in Serverless Handler Leading to Unexpected Restarts

16 messages · Page 1 of 1 (latest)

steady zephyr
#
2024-06-01T15:23:52.617148396Z 
2024-06-01T15:23:58.513146401Z Traceback (most recent call last):
2024-06-01T15:23:58.513169151Z   File "/src/rp_handler.py", line 19, in <module>
2024-06-01T15:23:58.513172031Z     from src.schemas.list import LIST_SCHEMA
2024-06-01T15:23:58.513173851Z ModuleNotFoundError: No module named 'src'

... Restarts after.

Serverless bug? not sure, but my handler restarts everytime it got an error like this

On that error, my handler does restart and doesnt return an error as what i hoped for ( after an exception is raised )

brisk oxide
#

What does your handler code look like?

#

It looks like there is a mismatch between your directory and your imports.

quartz obsidian
#

Yep looks more like a bug in the code than a serverless issue. This is usually the expected behaviour of serverless if your code has a bug in it. Best to try and test locally before deploying to serverless if you can.

steady zephyr
#

it works locally, not the error that im pointing out just the behaviour of it not stopping and just keep running until timeout i guess

steady zephyr
steady zephyr
quartz obsidian
#

Probably need __init__.py in the same folder as rp_handler.py

steady zephyr
#

i got it working already but if you can point out what was wrong its fine

steady zephyr
#

oh

quartz obsidian
steady zephyr
#

okay

muted cypress
#

why you put handler in src folder

steady zephyr
#

i removed src. from the import and it does work alr