Describe the bug
This issue occurs after I folIow the instructions on AWS Distro for OpenTelemetry Lambda Support For Java to add a layer (arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-20-1:3) and an enviroment variable (AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler) to a SQS Lambda trigger.
Steps to reproduce
I created a Lambda function as per the sample code:
package com.example;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.SQSEvent;
import com.amazonaws.services.lambda.runtime.events.SQSEvent.SQSMessage;
public class Handler implements RequestHandler<SQSEvent, Void> {
@Override
public Void handleRequest(SQSEvent event, Context context) {
for (final SQSMessage msg : event.getRecords()) {
System.out.println(new String(msg.getBody()));
}
return null;
}
}
then use the following SQS test event to test this Lambda function:
{
"Records": [
{
"messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb78",
"receiptHandle": "MessageReceiptHandle",
"body": "Hello from SQS!",
"attributes": {
"ApproximateReceiveCount": "1",
"SentTimestamp": "1523232000000",
"SenderId": "123456789012",
"ApproximateFirstReceiveTimestamp": "1523232000001"
},
"messageAttributes": {},
"md5OfBody": "{{{md5_of_body}}}",
"eventSource": "aws:sqs",
"eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:MyQueue",
"awsRegion": "us-east-1"
}
]
}
the execution log:
{
"errorMessage": "java.lang.NullPointerException",
"errorType": "java.lang.NullPointerException",
"stackTrace": [
"com.example.Handler.handleRequest(Handler.java:12)",
"java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
"java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)",
"java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)",
"java.base/java.lang.reflect.Method.invoke(Unknown Source)",
"io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingRequestWrapperBase.doHandleRequest(TracingRequestWrapperBase.java:66)",
"io.opentelemetry.instrumentation.awslambdacore.v1_0.TracingRequestHandler.handleRequest(TracingRequestHandler.java:79)"
]
}
If I removed the layer and the environment variable, NullPointerException is gone and everything works fine. It seems that this layer (aws-otel-java-wrapper) causes the problem.
What did you expect to see?
No exception will be thrown.
What version are you using?
arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-20-1:3
Environment
- AWS Lambda
- Runtime: Java 11 (Corretto)
- Architecture: x86_64
Additional context
None.
Describe the bug
This issue occurs after I folIow the instructions on AWS Distro for OpenTelemetry Lambda Support For Java to add a layer (
arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-20-1:3) and an enviroment variable (AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler) to a SQS Lambda trigger.Steps to reproduce
I created a Lambda function as per the sample code:
then use the following SQS test event to test this Lambda function:
{ "Records": [ { "messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb78", "receiptHandle": "MessageReceiptHandle", "body": "Hello from SQS!", "attributes": { "ApproximateReceiveCount": "1", "SentTimestamp": "1523232000000", "SenderId": "123456789012", "ApproximateFirstReceiveTimestamp": "1523232000001" }, "messageAttributes": {}, "md5OfBody": "{{{md5_of_body}}}", "eventSource": "aws:sqs", "eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:MyQueue", "awsRegion": "us-east-1" } ] }the execution log:
{ "errorMessage": "java.lang.NullPointerException", "errorType": "java.lang.NullPointerException", "stackTrace": [ "com.example.Handler.handleRequest(Handler.java:12)", "java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)", "java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)", "java.base/java.lang.reflect.Method.invoke(Unknown Source)", "io.opentelemetry.instrumentation.awslambdaevents.v2_2.TracingRequestWrapperBase.doHandleRequest(TracingRequestWrapperBase.java:66)", "io.opentelemetry.instrumentation.awslambdacore.v1_0.TracingRequestHandler.handleRequest(TracingRequestHandler.java:79)" ] }If I removed the layer and the environment variable,
NullPointerExceptionis gone and everything works fine. It seems that this layer (aws-otel-java-wrapper) causes the problem.What did you expect to see?
No exception will be thrown.
What version are you using?
arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-20-1:3Environment
Additional context
None.