-
-
Notifications
You must be signed in to change notification settings - Fork 797
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: Support httpApi authorizer with different config and function names #1763
fix: Support httpApi authorizer with different config and function names #1763
Conversation
@@ -326,7 +342,7 @@ export default class HttpServer { | |||
? serverlessAuthorizerOptions?.payloadVersion || "2.0" | |||
: "1.0", | |||
resultTtlInSeconds: | |||
serverlessAuthorizerOptions?.resultTtlInSeconds || "300", | |||
serverlessAuthorizerOptions?.resultTtlInSeconds ?? "300", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I was copying more of the config from serverlessAuthorizerOptions
but I un-did that to simplify the logic. However, this needed to be changed in order to allow 0
to be set for resultTtlInSeconds
inside the provider config.
reopen to run ci |
@adamldoyle Looks like |
…ck if httpApi before redirecting auth function
23048aa
to
014b518
Compare
@DorianMazur the failing test should be fixed now. |
Thank you @adamldoyle |
* master: fix: Support httpApi authorizer with different config and function names (dherault#1763) fix: Support ALB Event response headers (dherault#1756) v13.6.0 fix: treat application/octet-stream as a binary encoding (dherault#1587) feat: add support for provided.al2023 (dherault#1788) v13.5.1
Description
httpApi authorizer's have their config in the provider section with a name that can be used by httpApi events to attach that authorizer. The authorizer's underlying function is separately defined and is allowed to have a different name than the authorizer config in the provider section. The current implementation by serverless-offline requires that both of those names are the same. This PR fixes this issue by embedding all of the provider config and setting the function name to the one defined in the config.
Motivation and Context
Fixes #1624
How Has This Been Tested?
Manually tested with a small sample app that reproduced the initial issue. Updated existing integration tests that weren't actually using the correct authorizer names (they were using the function names). Added new integration test to reference an authorizer based on config name and have it point to a function name with a different name.
Screenshots (if appropriate):
N/A