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

methodArn not containing path parameters correctly #1043

Closed
sahandseifi opened this issue Jul 9, 2020 · 1 comment
Closed

methodArn not containing path parameters correctly #1043

sahandseifi opened this issue Jul 9, 2020 · 1 comment

Comments

@sahandseifi
Copy link

sahandseifi commented Jul 9, 2020

Hey there,

I believe the changes in #980 and have brought back #273 and #274

Essentially, when serverless-offline authorizer is running, it is using a methodArn that looks like: /user/{pathParam}

Based on API Gateway authorizer behavior, the methodArn in the authorizer should replace path parameters with their values injected, such as: /user/123

I believe the issue to be originating from this line:
5ff81fb#diff-cc0b2fc7c5601d386cac620be80b0f54R47

While request.path replaces path parameter placeholders with values, the request.route.path does not. Unfortunately I am not sure how to solve this without bringing back #980, but if anyone has suggestions I can create a PR.

serverless-offline: 6.4.0
serverless: 1.73.1
npm: 6.14.5

@danilofuchs
Copy link
Contributor

danilofuchs commented Jul 24, 2020

Nice catch, @sahandseifi! The API Gateway conventions are very confusing to understand and unfortunately this project does not have a nice test suite around these fields. (I believe there are no tests for authorizer context at all).

I'm not sure what is the best path there. Perhaps we could start by writing one integration test which validates all the fields in an authorizer event and context, based on a real invocation. This way, we will be able to identify this and many more other issues.

I'm really sorry of unintentionally breaking this with my PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants