-
-
Notifications
You must be signed in to change notification settings - Fork 796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runs very slowly with AWS Python Lambda functions #742
Comments
hey @Jordan-Eckowitz I'm not a |
just rewrote the (fairly buggy) |
Hey @dnalborczyk Thanks for taking this on and re-opening the issue! I just tried updating to the latest v6 alpha release and its still the same for me. It takes ~2s to return a hello-world response when running the API regularly and ~16s when running it within a Docker container. As before, the Node.js response time is the same whether or not running via Docker - the same hello-world response takes ~5ms. |
it wasn't released yet. it was released with version closing as this should be resolved. btw, it still has some rough edges to be ironed out. some feedback would be welcome! |
I tried updating to
|
@Jordan-Eckowitz just tried a couple combinations with https://github.com/dherault/serverless-offline/tree/master/__tests__/integration/python/python-big-json (I copied it out and changed the plugin-path in yml) |
Hi @dnalborczyk , Thanks again for all the help - you're an absolute legend! I've re-created the issue and saved it in this repo: https://github.com/Jordan-Eckowitz/serverless-offline-python-3 Please let me know if there's anything else you need from me. |
😄 thank you! alrighty, just debugged your issue. unfortunately I don't know why this is working in v5, but I can tell you why it's not working in v6. it's this condition:
for a quick test you could just do: module.exports.pyHandler = () => { or move |
Great debugging! I also don't understand why the args would no longer be within the Most of my endpoints, however, are not returning results anymore. It thinks for about a second and the call then ends without any logging information other than the message They're primarily Lambdas that retrieve SQL data via AWS |
Good to hear!
I'm guessing you have some stay tuned! |
Ah yeah, that's it - I commented out the |
@Jordan-Eckowitz ah, nice! I'm guessing the easiest would be just to assign to something specific here: https://github.com/dherault/serverless-offline/blob/master/src/handler-runner/invoke.py#L90 sys.stdout.write(json.dumps(result)) something like this, the javascript equivalent of do you know the equivalent of the following in python by any chance? const data = { payload: result }
JSON.stringify(data) ... ? ....
sys.stdout.write(json.dumps(data)) |
nm, I suppose it's something like this: data = {
"payload": result
}
sys.stdout.write(json.dumps(data)) |
the fix should be available in the btw, you should be able to use |
Hey @dnalborczyk - I tried it earlier and working without any issues - great job! |
I have setup a Serverless API Gateway with both Node.js (10.x) and Python (3.7) Lambdas.
I've compared simple endpoints in both languages that just return the string "hello world". It takes a few milliseconds with Node.js but about 2 seconds with Python to get a response.
When I run it from within a Docker container Node.js is as fast as outside the container. But, Python takes as long as 12 seconds to get a response.
Has anybody else had this issue with Python functions?
The text was updated successfully, but these errors were encountered: