Open Hurtak opened 1 year ago
I've been running into this constantly. The simplest solution is to change the line @Hurtak called out:
port.postMessage(JSON.parse(JSON.stringify(result)))
Not pushing a PR as there's probably a better way to serialize, but it gets the job done for me.
Bug Report
Current Behavior
When you return non-serializible data from the lambda, serverless prints very cryptic error message with no user code stack trace and 0 information
Example code:
Error when caaling this endpoint:
I traced it down to this TODO line of code in serverless-offline https://github.com/dherault/serverless-offline/blob/5b198a752c8cfdcbde5e3eb7e041a64ac3626289/src/lambda/handler-runner/worker-thread-runner/workerThreadHelper.js#L29-L30
Expected behavior/code
Probably one of the two would be good
Misc
I was not that familiar with Serverless (using it for a few weeks only) so I have spent a lot of time figuring this one out (probably around 10 hours) - I had no idea where to look for what was wrong, and I had to connect to debugger and step through serverless-offline code to figure this out. So having good error message in this place could probably be big usability/accessibility win for future versions.