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

fix: LambdaProxyIntegrationEventV2 authorizer context #1630

Merged
merged 3 commits into from
Sep 30, 2023

Conversation

rishi8094
Copy link
Contributor

Description

The LambdaProxyIntegrationEventV2 does not return custom authorizer contexts in the correct format. Currently, any context data is returned directly within the authorizer object:

{
  "requestContext": {
    "authorizer": {
      "foo": "bar"
    }
  }
}

Instead of being nested in the lambda object:

{
  "requestContext": {
    "authorizer": {
      "lambda": {
        "foo": "bar"
      }
    }
  }
}

Motivation and Context

This change is required as it breaks the local implementation of the custom authorizer.

@rishi8094 rishi8094 marked this pull request as ready for review December 14, 2022 16:33
@rishi8094 rishi8094 marked this pull request as draft December 14, 2022 18:49
@rishi8094 rishi8094 marked this pull request as ready for review December 14, 2022 18:55
@rishi8094 rishi8094 marked this pull request as draft December 15, 2022 15:31
@dnalborczyk
Copy link
Collaborator

thank you for your PR @rishi8094 I have not looked into the details of your PR yet, but you might have to fix the test?

@rishi8094
Copy link
Contributor Author

rishi8094 commented Dec 27, 2022

thank you for your PR @rishi8094 I have not looked into the details of your PR yet, but you might have to fix the test?

Thank you for taking a look. I have now updated the relevant test case for the proposed fix.

@rishi8094 rishi8094 marked this pull request as draft January 1, 2023 17:38
@rishi8094 rishi8094 marked this pull request as ready for review February 1, 2023 08:07
@rishi8094
Copy link
Contributor Author

@dnalborczyk recently pushed the passing test case, think it's good for a review now.

@rishi8094
Copy link
Contributor Author

Hey @dnalborczyk, wanted to follow up on this PR.

@casewalker
Copy link

Hello! My team is utilizing custom authorizers in Serverless and running locally with serverless-offline, and we have noticed the issue which this PR is setup to fix.

For more context, it appears that AWS uses APIGatewayProxyEventV2WithLambdaAuthorizer for the event-argument of a Lambda behind an Authorizer (seen here), and if you follow the types through their generic arguments, you get to APIGatewayEventRequestContextLambdaAuthorizer, where the actual authorizer's context is in fact wrapped as an object under the lambda key.

Our code will be partially incorrect and more brittle until this PR is merged and released, so I urge you to please merge this at your earliest convenience. Thank you!

@dnalborczyk
Copy link
Collaborator

close/re-open in order to run ci.

@dnalborczyk dnalborczyk reopened this Sep 24, 2023
@dnalborczyk dnalborczyk merged commit 5b82612 into dherault:master Sep 30, 2023
0 of 6 checks passed
@dnalborczyk
Copy link
Collaborator

thank you @rishi8094

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

Successfully merging this pull request may close these issues.

None yet

3 participants