I think #292 has led to different behaviour between serverless-offline and Lambda, at least in certain configurations.
My functions implement dealing with the authorization header themselves -- I do not use a separate authorizer function or IAM authorization.
serverless-offline is adding the decoded token to event.requestContext, and I see the decoded claims in key event.requestContext.authorizer.claims. This seemed useful and so I made use of it when developing (my function decorator then only has to validate the token signature). However, when deployed, then event.requestContext.authorizer key does not exist, at least with my configuration.
Hi @tremby, is your issue fix by serverless-offline v3.32.0 ? event.requestContext has been modified to handle authorizer functions more clearly.
Is that a typo? Latest tag I see on this project is 3.25.17.
version v3.32.1 is available on npm :)
I'll give it a try next time I work on the project in question.
We are seeing this as well -- with a custom authorizer the claims are appearing locally on event.requestContext.authorizer.claims. However, when running in aws via LAMBDA_PROXY integration there are no claims inside the authorizer object.
Could you fix it via a PR please ?
@tremby @djakaitis could you provide a small repository with some repro steps?
closing for inactivity. the latest v6 alpha had some additional changes regarding authorizer. feel free to re-open if this is still an issue.
hi, i can access event.requestContext.authorizer.claims in my local via serverless-offline but after deploying to AWS, there's no authorizer in event.requestContext. what's the fix here?
Most helpful comment
hi, i can access
event.requestContext.authorizer.claimsin my local viaserverless-offlinebut after deploying to AWS, there's noauthorizerinevent.requestContext. what's the fix here?