fix(aws-lambda): fix awsRequest to return request with runtime metadata#4288
fix(aws-lambda): fix awsRequest to return request with runtime metadata#4288fossamagna wants to merge 1 commit into
Conversation
… awsLambda property
|
Someone is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR fixes two critical bugs in the AWS Lambda preset's ChangesAWS Lambda request runtime metadata fix
🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #4287
Summary
Fixes two bugs in
awsRequest()insrc/presets/aws-lambda/runtime/_utils.tsthat causedrequest.runtime.awsLambdato always beundefinedin request handlers.Bug 1: Runtime metadata was discarded
The function set
req.runtime.awson aServerRequestobject, but then returned a brand-newRequestobject, losing all the runtime metadata that had just been set.Bug 2: Wrong property name (
aws→awsLambda)The runtime context was stored under
req.runtime.aws, but srvx'sServerRequesttype exposes it asruntime.awsLambda. The@ts-expect-errorsuppression was masking this type mismatch.Changes
reqobject instead of creating a newRequestreq.runtime.aws→req.runtime.awsLambda(aligns with srvx types, removes@ts-expect-error)contextparameter asContextinstead ofunknownawsRequest()Motivation
Users relying on
request.runtime.awsLambdato access the Lambdaeventandcontext(e.g. for use with@aws-lambda-powertools/logger) would always receiveundefined.