Skip to content
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

Feature: A dummy Rust Lambda extension #1

Open
heitorlessa opened this issue Jan 27, 2022 · 13 comments
Open

Feature: A dummy Rust Lambda extension #1

heitorlessa opened this issue Jan 27, 2022 · 13 comments

Comments

@heitorlessa
Copy link

Firstly, thank you for creating this repository. It's a great finding to know any External Lambda Extension gives customers the ability to handle SIGTERM signal.

It'd be great to have a dummy extension instead of Lambda Insights, since the latter can incur charges.

@nmoutschen
Copy link

Should be pretty straightforward with the new lambda_extension. We could have a simple no-op service there.

@bnusunny
Copy link
Contributor

Is it available as a cargo crate?

@nmoutschen
Copy link

Not yet, but you can use it from git at the moment :)

lambda-extension = { git = "https://github.com/awslabs/aws-lambda-rust-runtime", branch = "master" }

@heitorlessa
Copy link
Author

heitorlessa commented Jan 27, 2022 via email

@ldragone
Copy link

@heitorlessa could you explain what you mean by "call/register RAPID API as an internal extension"?
I haven't found any other examples on the internet that explain how to read SIGTERM signals without registering an extension.

Thanks in advance!

@bnusunny
Copy link
Contributor

@luigidragone96 an internal extension is a thread in a lambda function that talks to the extension API. We have some examples. I will post it here once I found it.

@ldragone
Copy link

Thank you! The examples would be very useful.
At the moment I am using the workaround using an AWS managed extension, in particular the new extension for get parameter and secrets from SSM.

@bnusunny
Copy link
Contributor

This is for python. Put the code outside of your handler.

image

@ldragone
Copy link

@bnusunny thanks for sharing this example.
I tried to do something similar with a lambda in NodeJS but I get the error 403 "Extension registration closed already"

{"errorMessage":"Extension registration closed already","errorType":"Extension.RegistrationClosed"}

NodeJS lambdas don't support internal extensions?

@bnusunny
Copy link
Contributor

bnusunny commented Nov 20, 2022

Could you share your test code? Extension registration should happen during the init phase (before the handler function is called).

@anzemur
Copy link

anzemur commented May 5, 2023

So we can't use the graceful shutdown if we don't use any external extensions? Is there a way to create a dummy extension in Node.js that would serve only to catch the SIGTERM signal in lambda handler?

@bnusunny
Copy link
Contributor

bnusunny commented May 5, 2023

Both external and internal extensions can enable graceful shutdown.

You can create an internal extension in node.js following the python example I posted above.

@anzemur
Copy link

anzemur commented May 6, 2023

@bnusunny Thank you! Do you have an example of an internal extension written for Node.js, or maybe just a code example with some descriptions of what we should do and why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants