AWS Serverless ApiGateway rawPath is null
See original GitHub issueDescribe the bug
I am using Quarkus with GraalVM with native-image which is deployed on AWS Serverless:
-
AWS ApiGateway
-
AWS Lambda
SAM template
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS Serverless Quarkus Lambda play
Globals:
Api:
EndpointConfiguration: REGIONAL
BinaryMediaTypes:
- "*/*"
Parameters:
Environment:
Type: String
CommitSha:
Type: String
MemorySize:
Type: Number
SecurityGroupsIds: # list of string dynamic reference is not yet supported
Type: AWS::SSM::Parameter::Value<List<String>>
SubnetIds:
Type: AWS::SSM::Parameter::Value<List<String>>
Resources:
ApiDeployment:
Type: AWS::Serverless::Api
Properties:
StageName: !Ref Environment
BackendNative:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "quarkus-lambda-play-${Environment}"
Description: !Ref CommitSha
Handler: not.used.in.provided.runtimei
Runtime: provided
CodeUri: "../../build/function.zip"
AutoPublishAlias: live
MemorySize: !Ref MemorySize
Timeout: 180
Role: !Sub "{{resolve:ssm:/myapp/${Environment}/lambda/role-arn:1}}"
ReservedConcurrentExecutions: 10
Tracing: Active
Events:
GetResource:
Type: Api
Properties:
Path: /{proxy+}
Method: any
RestApiId: !Ref ApiDeployment
VpcConfig:
SecurityGroupIds: !Ref SecurityGroupsIds
SubnetIds: !Ref SubnetIds
Tags:
project: "Quarkus Lambda play"
I upgraded Quarkus from 1.11.3.Final
to 1.12.2.Final
It is failing now with an error:
| 2021-03-15T22:34:53.850+02:00 | 2021-03-15 20:34:53 \| [ERROR] http - Request Failure: java.lang.NullPointerException
-- | -- | --
| 2021-03-15T22:34:53.850+02:00 | at java.lang.StringBuilder.<init>(StringBuilder.java:124)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.http.LambdaHttpHandler.nettyDispatch(LambdaHttpHandler.java:153)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:59)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:39)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder$1.processRequest(AmazonLambdaRecorder.java:152)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.runtime.AbstractLambdaPollLoop$1.run(AbstractLambdaPollLoop.java:78)
| 2021-03-15T22:34:53.850+02:00 | at java.lang.Thread.run(Thread.java:834)
Expected behavior
it should work fine how it worked in 1.11.3.Final
version
Actual behavior
Fails with an error
| 2021-03-15T22:34:53.850+02:00 | 2021-03-15 20:34:53 \| [ERROR] http - Request Failure: java.lang.NullPointerException
-- | -- | --
| 2021-03-15T22:34:53.850+02:00 | at java.lang.StringBuilder.<init>(StringBuilder.java:124)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.http.LambdaHttpHandler.nettyDispatch(LambdaHttpHandler.java:153)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:59)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:39)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder$1.processRequest(AmazonLambdaRecorder.java:152)
| 2021-03-15T22:34:53.850+02:00 | at io.quarkus.amazon.lambda.runtime.AbstractLambdaPollLoop$1.run(AbstractLambdaPollLoop.java:78)
| 2021-03-15T22:34:53.850+02:00 | at java.lang.Thread.run(Thread.java:834)
Most likely it is relevant to this change - https://quarkus.io/blog/path-resolution-in-quarkus/
To Reproduce
Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).
Or attach an archive containing the reproducer to the issue.
Steps to reproduce the behavior:
- Generate ‘hello world’ project
- Build a native image, deploy function.zip to AWS Lambda
- Trigger the Lambda
Configuration
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss} | %X{userId} [%-5p] %c{1} - %m%n
quarkus.log.category."software.amazon.awssdk".level=WARN
quarkus.log.category."software.amazon.awssdk.request".level=DEBUG
quarkus.log.category."io.quarkus.bootstrap".level=WARN
quarkus.log.category."com.igor.repository".level=DEBUG
quarkus.http.cors=true
quarkus.http.cors.origins=*
quarkus.http.cors.headers=accept,authorization,content-type,x-requested-with
quarkus.http.cors.methods=GET,POST,PUT,PATCH,DELETE,OPTIONS
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=${JDBC_LOGIN}
quarkus.datasource.password=${JDBC_PASSWORD}
quarkus.datasource.jdbc.url=${JDBC_URL}
quarkus.mybatis.map-underscore-to-camel-case=true
quarkus.native.additional-build-args=--report-unsupported-elements-at-runtime
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
Output of uname -a
or ver
Output of java -version
11
GraalVM version (if different from Java)
21.0.0.2
Quarkus version or git rev
1.12.2.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
6.5.1
Additional context
(Add any other context about the problem here.)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
My AWS API Gateway REST API with lambda function is ...
My Lambda function code seems to be correct, but when I call this API from POSTMAN or react application it returns NULL. LAMBDA...
Read more >Using AWS Lambda with Amazon API Gateway
API Gateway provides tools for creating and documenting web APIs that route HTTP requests to Lambda functions.
Read more >Lambda Annotations - Complex Request type is always null ...
Playing around with the new Annotations library, and I cannot seem to get a complex request to come through in the body of...
Read more >Working with Amazon Lambda proxy integrations for HTTP APIs
A Lambda proxy integration enables you to integrate an API route with a Lambda function. When a client calls your API, API Gateway...
Read more >The case of the missing path in a lambda event: a mystery in 2 ...
The AWS API Gateway provides two different ways to invoke a Lambda ... while the HTTP API event contains the path in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
as a workaround I use
io.quarkus:quarkus-amazon-lambda-http-v1
it works with
quarkus-amazon-lambda-rest
, thanks