You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(lambda): handle missing context for some lambda functions (#7445)
* fix(lambda): handle missing context for Lambda Authorizers
Lambda Authorizers and some other Lambda handler types do not receive
a context object - they only receive an event parameter. Previously,
the extractContext() function would throw "Could not extract context"
when it couldn't find a context object with getRemainingTimeInMillis.
This change makes extractContext() return undefined instead of throwing,
and updates the datadog() wrapper to skip timeout checking when context
is not available. This allows Lambda Authorizers to be instrumented
without crashing.
Fixes: DataDog/datadog-lambda-js#721
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Undefined cleanup.
* Add getRemainingTimeInMillis check back.
* Update packages/dd-trace/src/lambda/handler.js
Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
* Move extractContext to separate file and add more tesets.
* Linting.
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Rey Abolofia <rey.abolofia@datadoghq.com>
Co-authored-by: Rey Abolofia <purple4reina@gmail.com>
Co-authored-by: Ruben Bridgewater <ruben@bridgewater.de>
0 commit comments