Skip to content

Commit

Permalink
fix: LambdaProxyIntegrationEventV2 authorizer context (#1630)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishi8094 authored Sep 30, 2023
1 parent 1756f98 commit 5b82612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export default class LambdaProxyIntegrationEventV2 {
this.#request.auth.credentials.context) ||
{}

// AWS adds the lambda key to the auth context object
const lambdaAuthContext = { lambda: authContext }

let authAuthorizer

if (env.AUTHORIZER) {
Expand Down Expand Up @@ -154,7 +157,7 @@ export default class LambdaProxyIntegrationEventV2 {
apiId: 'offlineContext_apiId',
authorizer:
authAuthorizer ||
assign(authContext, {
assign(lambdaAuthContext, {
jwt: {
claims,
scopes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('custom authentication serverless-offline variable tests', function des

const json = await response.json()
assert.deepEqual(
json.event.requestContext.authorizer.expected,
json.event.requestContext.authorizer.lambda.expected,
'it works',
)
})
Expand Down

0 comments on commit 5b82612

Please sign in to comment.