Add Lambda Function URL example
Closed this issue Β· 4 comments
Issue Body
Hey team! π
So I noticed we support Lambda Function URLs in the Event Handler, but we don't have any examples showing how to actually use them. Python has a dedicated example for this, and I think it'd be super helpful to have one for TypeScript too.
The Problem
Right now, if you want to use Function URLs with Powertools TypeScript, you have to:
- Dig through the docs to figure out the event format
- Guess at the best practices for CORS and auth
- Trial-and-error your way through the setup
Not ideal, especially when Function URLs are such a nice alternative to API Gateway for simple stuff.
What I'm Proposing
Add a proper example showing how to use Lambda Function URLs with the Event Handler. Something like:
examples/snippets/event-handler/lambda-function-url/
βββ README.md # Quick start guide
βββ package.json
βββ src/
β βββ index.ts # The actual handler code
βββ infrastructure/
β βββ template.yaml # SAM or CDK, whatever works
βββ tests/
βββ index.test.ts # Some basic tests
The example should cover:
- Basic routing with Function URLs
- CORS setup (because everyone struggles with this)
- Auth options (IAM vs public)
- How to actually deploy and test it
Why This Matters
Function URLs are great for:
- Quick prototypes
- Internal tools
- Webhooks
- Anything where you don't need all the API Gateway bells and whistles
Plus, Python already has this example, so it'd be nice to have feature parity.
I Can Help!
I'm a huge fan of Powertools and would love to contribute this. If you assign it to me, I can:
- Write the example code
- Add the infrastructure templates
- Create a README that actually makes sense
- Test everything end-to-end
Just let me know if you're interested and any specific patterns you'd like me to follow!
Cheers! π
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link
Hi @dcabib, thanks for opening this issue! It's great to see your enthusiasm for contributing to Powertools for AWS across all runtimes. We really appreciate it, as this project is being developed together with the community.
When opening an issue, we encourage customers to use our issue templates, since we have automations set up for them. I noticed you skipped this step, likely because you opened the issue from your IDE. If so, you can configure your GenAI assistant or IDE to open issues using the template to avoid this.
Also, we aim to support customers with easy adoption in a progressive way. In this case, you proposed creating documentation for a feature that has not been released yet - Event Handler HTTP/Rest. Additionally, the structure you suggested for the examples looks more like a SAM project rather than proper Powertools for AWS documentation/style. Our documentation covers different aspects of our utilities and presents use cases for each feature, rather than full projects. For example, see this feature where we start with a simple code and then progress explaining all the possible use cases and how customers can use them: https://docs.powertools.aws.dev/lambda/typescript/latest/features/event-handler/appsync-events/.
We love ideas and community contributions, so please donβt lose your excitement to contribute to Powertools for AWS. However, I think you likely have other things to do in your regular work day and Iβm a little concerned that having too many issues to work on might make it harder to keep up and complete - please correct if I'm wrong. Also having unfinished contributions can also increase the workload on maintainers, because we must carefully manage ongoing work and ensure it is completed, which can add a lot of load to our works.
I think what we can do now is 1/ we close this issue, 2/ we wait for you to finish all the other contributions you're working on, 3/ we can revisit our backlog after that, and then start on other contributions. What do you think?
Once again, thank you so much for all your contributions, today you did an amazing job and got 3 PRs approved in one day in Python, we're just trying to keep things under control here.
Tagging other maintainers for greater visibility @dreamorosi @phipag @hjgraca @svozza @matteofigus @anafalcao @sthulb
It's a pleasure to help... Let's close this issue, and when the team believes it's okay to add this example in TypeScript, I will be happy to help.
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.