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

Lambda-Event-Path-and-Resource-Sync #1137

Merged

Conversation

matt-peck
Copy link
Contributor

Description

Change LambdaProxyIntegrationEvent returned resource to use non-stagePrepended URL from instance #path intead of route.path.

Motivation and Context

When running serverless-offline locally, the LambdaProxyIntegrationEvent uses the route.path to define the event.resource instead of this.#path. When using stages prepended to URLs to keep in step with a multi-environment local development setup (i.e. multiple environments tested with Postman), it is desirable to have the stage prepend the endpoint URL, but not desirable for the stage to mutate the event.resource where router / controller logic is determined.

Fixes: #1029

How Has This Been Tested?

Ran AWS Lambdas locally with URLs prepended by Stage with Postman.

…ely removing the stage variable from resource
@dherault dherault merged commit b74f49d into dherault:master Dec 9, 2020
@dherault
Copy link
Owner

dherault commented Dec 9, 2020

Thanks @matt-peck, will be included with the next version!

@matt-peck-masheen
Copy link

@dherault Awesome! Thank you so much!

@matt-peck
Copy link
Contributor Author

@dherault I was helping some devs set this up locally this morning and discovered that this breaks path parameters because this.#path specifies the actual path parameter value where as route.path specifies the parameter variable.

I added the change here: https://github.com/matt-peck/serverless-offline/blob/Lambda-Event-Path-And-Resource-Sync/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js

Line 131 and 200.

How should I submit this, a new 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
Development

Successfully merging this pull request may close these issues.

Handler event path and resource don't match pattern returned from lambda
3 participants