{"record":{"id":"7a45116219f60625","repo":"quarkusio/quarkus","slug":"aws-context-not-set-7a4511","errorCode":null,"errorMessage":"aws context not set","messagePattern":"aws context not set","errorType":"http","errorClass":"RuntimeException","httpStatus":500,"severity":"info","filePath":"integration-tests/amazon-lambda-http-resteasy-reactive/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java","lineNumber":57,"sourceCode":"    }\n\n    @POST\n    @Path(\"empty\")\n    public void empty() {\n\n    }\n\n    @Context\n    com.amazonaws.services.lambda.runtime.Context ctx;\n\n    @GET\n    @Path(\"context\")\n    @Produces(MediaType.TEXT_PLAIN)\n    public void context() {\n        if (ctx == null)\n            throw new RuntimeException();\n        if (ctx.getAwsRequestId() == null)\n            throw new RuntimeException(\"aws context not set\");\n    }\n\n    @GET\n    @Path(\"proxyRequestContext\")\n    @Produces(MediaType.TEXT_PLAIN)\n    public void proxyRequestContext(@Context APIGatewayV2HTTPEvent event) {\n        if (event == null)\n            throw new RuntimeException();\n    }\n\n    @Inject\n    APIGatewayV2HTTPEvent injectEvent;\n\n    @GET\n    @Path(\"inject-event\")\n    @Produces(MediaType.TEXT_PLAIN)\n    public void injectEvent() {\n        if (injectEvent == null)","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/amazon-lambda-http-resteasy-reactive/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java#L39-L75","documentation":"In the RESTEasy Reactive variant, GreetingResource reads the AWS Lambda Context via a field (com.amazonaws.services.lambda.runtime.Context ctx injected by the Quarkus Lambda extension, line 47-48) and throws RuntimeException(\"aws context not set\") when ctx.getAwsRequestId() is null. It verifies Context injection into resources in the reactive stack; null means the Lambda runtime Context was not populated.","triggerScenarios":"GET /hello/context when served outside the AWS Lambda invocation path (plain dev-mode HTTP), or when the Lambda extension fails to populate the injected Context so getAwsRequestId() is null.","commonSituations":"Local quarkus:dev testing where no AWS Context exists; payload format (v1/v2) mismatch preventing Context injection; extension wiring issues in the reactive variant.","solutions":["Hit the endpoint via API Gateway/Lambda so the AWS runtime Context exists during the invocation","Confirm the quarkus-amazon-lambda-http (reactive) extension version supports Context field injection and matching payload format","If testing locally, expect the failure — the AWS Context is only present during real Lambda invocations"],"exampleFix":"// before\n// GET /hello/context in local dev mode -> ctx == null / requestId null\n// after\n// deploy or test through SAM/API Gateway so Context is injected:\ncurl https://<api-gateway-id>.execute-api.<region>.amazonaws.com/hello/context","handlingStrategy":"validation","validationCode":"// only meaningful when invoked via Lambda\nboolean viaLambda = eventSource == EventSource.API_GATEWAY || runningInLambda;\nif (!viaLambda) { /* injected AWS Context will be null */ }","typeGuard":null,"tryCatchPattern":"try {\n    given().get(\"/hello/context\");\n} catch (RuntimeException e) {\n    if (\"aws context not set\".equals(e.getMessage())) { /* no Lambda runtime context */ }\n}","preventionTips":["Invoke through API Gateway/Lambda so the Context field is populated","Avoid asserting Context injection outside real Lambda invocations","Keep the reactive lambda-http extension version aligned with the payload format used"],"tags":["aws-lambda","context-injection","resteasy-reactive","test"],"backgroundTag":"missing-runtime-context","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}