Skip to content

NPE when getting request params from spark #168

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

Closed
jschwartz73 opened this issue Jun 28, 2018 · 3 comments
Closed

NPE when getting request params from spark #168

jschwartz73 opened this issue Jun 28, 2018 · 3 comments
Labels
Milestone

Comments

@jschwartz73
Copy link
Contributor

  • Framework version: 1.2-SNAPSHOT
  • Implementations: Spark

Scenario

Deployed the pet-store sample application and did a
curl -X GET https://xxx.execute-api.us-east-1.amazonaws.com/Prod/pets

Expected behavior

Retrieve the list of pets

Actual behavior

NullPointerException in CloudWatch logs

Steps to reproduce

Follow steps in the samples/spark/pet-store/README.md file. Once the api is deployed, try to load the list of pets. If you do not specify a query param, then the api call with throw a NPE

Full log output

[2018-06-28 02:52:17.506] 44e2c3a8-7a7e-11e8-b691-47933127b3f5 ERROR s.h.m.GeneralError -
java.lang.NullPointerException: null
at com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest.getQueryParamValue(AwsProxyHttpServletRequest.java:819)
at com.amazonaws.serverless.proxy.internal.servlet.AwsProxyHttpServletRequest.getParameter(AwsProxyHttpServletRequest.java:445)
at spark.Request.queryParams(Request.java:283)
at spark.http.matching.RequestWrapper.queryParams(RequestWrapper.java:141)
at com.amazonaws.serverless.sample.spark.SparkResources.lambda$defineResources$2(SparkResources.java:37)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at com.amazonaws.serverless.proxy.internal.servlet.FilterChainHolder.doFilter(FilterChainHolder.java:84)
at com.amazonaws.serverless.sample.spark.filter.CognitoIdentityFilter.doFilter(CognitoIdentityFilter.java:60)
at com.amazonaws.serverless.proxy.internal.servlet.FilterChainHolder.doFilter(FilterChainHolder.java:84)
at com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler.doFilter(AwsLambdaServletContainerHandler.java:207)
at com.amazonaws.serverless.proxy.spark.SparkLambdaContainerHandler.handleRequest(SparkLambdaContainerHandler.java:195)
at com.amazonaws.serverless.proxy.spark.SparkLambdaContainerHandler.handleRequest(SparkLambdaContainerHandler.java:76)
at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxy(LambdaContainerHandler.java:168)
at com.amazonaws.serverless.proxy.internal.LambdaContainerHandler.proxyStream(LambdaContainerHandler.java:200)
at com.amazonaws.serverless.sample.spark.StreamLambdaHandler.handleRequest(StreamLambdaHandler.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at lambdainternal.EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:350)
at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:888)
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:283)
at lambdainternal.AWSLambda.(AWSLambda.java:64)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:94)
[2018-06-28 02:52:17.526] 44e2c3a8-7a7e-11e8-b691-47933127b3f5 INFO c.a.s.p.i.LambdaContainerHandler - 76.233.4.20 - [28/06/2018:02:52:17Z] "GET /pets HTTP/1.1" 500 60 "-" "curl/7.37.0" combined
[2018-06-28 02:52:17.720] 4504cb86-7a7e-11e8-8599-899b2f39a101 WARN c.a.s.s.s.f.CognitoIdentityFilter - Cognito identity id in request is null

sapessi added a commit that referenced this issue Jun 28, 2018
#168 - Fixed NPE when no query params are sent with the request
@sapessi sapessi added this to the Release 1.2 milestone Jun 28, 2018
@sapessi sapessi added the bug label Jun 28, 2018
@jschwartz73
Copy link
Contributor Author

The pull request resolved the issue

@sapessi sapessi reopened this Jul 21, 2018
@sapessi
Copy link
Contributor

sapessi commented Jul 21, 2018

I'll keep it open until the fix is published to maven

@sapessi
Copy link
Contributor

sapessi commented Aug 2, 2018

Closing since the feedback was included in the 1.1.4 release.

@sapessi sapessi closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants