-
Notifications
You must be signed in to change notification settings - Fork 556
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
Custom context for function handlers result in panic #377
Comments
The document and the implementation of the validator are wrong. The document says:
it should be:
#365 will fix this. |
Thank you. I got the latest module as follows, and I can confirm that the panic doesn't happen in the custom context.
|
Is your feature request related to a problem? Please describe.
In the AWS documentation, the handler for the function is shown to have the following signature
https://docs.aws.amazon.com/lambda/latest/dg/golang-handler.html
But it also says the following.
The first argument in the signature of the function that takes two arguments is clearly
context.Context
, but thepanic
occurs whencustomContext
is taken as an argument.For example, deploy and execute the following code to AWS Lambda.
When this Lambda is executed, a panic occurs as shown below.
Describe the solution you'd like
If we take
context.Context
as an argument, we need to make sure that the first argument of the function signature iscontext.Context
explicitly.aws-lambda-go/lambda/handler.go
Lines 48 to 50 in 5d64132
The above implementation only checks if the argument satisfies
context.Context
, so if a custom context that satisfiescontext.Context
is the first argument, it cannot be checked by the above validation.Describe alternatives you've considered
I wasn't sure if it was correct to explicitly accept only
context.Context
as a signature, or if we will accept a custom context satisfyingcontext.Context
as a function signature.Additional context
Nothing.
The text was updated successfully, but these errors were encountered: