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

api event is missing the stage property #189

Merged
merged 1 commit into from Nov 13, 2017

Conversation

holygrolli
Copy link
Contributor

Using aws-serverless-java-container to run a Spring application in a Lambda function I was continuously getting errors.

How to reproduce?

  1. Checkout and build the Spring example.
  2. run with sam local start-api -t sam.yaml (latest release and latest develop build)
  3. run curl http://localhost:3000/pets and get {"message":"Gateway timeout"}

What causes Gateway timeout?

It is caused by a Java NullPointerException at spring-web-4.3.9.RELEASE-sources.jar!/org/springframework/web/util/UrlPathHelper.java:245 originating from org.springframework.web.util.UrlPathHelper#getPathWithinApplication because com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest#getContextPath requires the stage be set. When I understand the events correctly (and the event generator supports my assumption) then the stage property must be set

How to fix

I added the fixed string prod to the events stage property. I assume for aws-sam-local there is no need for other stages.

@PaulMaddox
Copy link
Contributor

Thanks for this, and thanks for the test case to go with it.

Copy link
Contributor

@PaulMaddox PaulMaddox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PaulMaddox PaulMaddox merged commit 90bda48 into aws:develop Nov 13, 2017
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.

None yet

2 participants