-
Notifications
You must be signed in to change notification settings - Fork 421
Feature request: provide Parser models for Lambda Authorizer #4536
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
Comments
Thank you so much for opening this issue with so many details @dreamorosi! I'll work on it until the end of this week. |
|
This is now released under 2.41.0 version! |
Use case
As a customer, when writing Lambda Authorizer functions for API Gateway, I would like to use the Parser utility to parse and validate the payload received by my function.
Solution/User Experience
Based on my tests, there are 3 models that could be added:
APIGatewayRequestAuthorizerEventSchema
APIGatewayTokenAuthorizerEventSchema
APIGatewayRequestAuthorizerEventV2Schema
The first two are used by API Gateway REST API (v1) when configuring a Lambda authorizer. With this version of API Gateway customers can choose whether the authorizer is looking only at the token or at the entire request and based on this the payload that the function receives changes.
For request authorizers the payload looks like this:
while for token authorizers it looks like this:
The last one is instead related to API Gateway HTTP API (v2) which as far as I can tell only supports one request type with the following payload:
In terms of DX, the model should work the same as the existing ones:
Note
I have tested all payload types I could think of, including the ones above, with Node.js functions - if you want to double check the payloads you can look at this comment here.
Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: