Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/runtimes/fpm-runtime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Here is an example to retrieve it:
$lambdaContext = json_decode($_SERVER['LAMBDA_INVOCATION_CONTEXT'], true);
```

The request ID of the invocation is also available directly in `$_SERVER['LAMBDA_REQUEST_ID']`, like in [the other runtimes](./runtimes-details.mdx#environment-variables).
The request ID of the invocation is also available directly in `$_SERVER['LAMBDA_REQUEST_ID']`, and the X-Ray trace ID in `$_SERVER['_X_AMZN_TRACE_ID']`, like in [the other runtimes](./runtimes-details.mdx#environment-variables).

### Request context

Expand Down
3 changes: 2 additions & 1 deletion src/FpmRuntime/FpmHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ private function eventToFastCgiRequest(HttpRequestEvent $event, Context $context
$request->setCustomVar('PATH_INFO', $event->getPath());
$request->setCustomVar('QUERY_STRING', $event->getQueryString());
$request->setCustomVar('LAMBDA_INVOCATION_CONTEXT', json_encode($context, JSON_THROW_ON_ERROR));
// Same variable as in the other runtimes, see LambdaRuntime::processNextEvent()
// Same variables as in the other runtimes, see LambdaRuntime::processNextEvent()
$request->setCustomVar('LAMBDA_REQUEST_ID', $context->getAwsRequestId());
$request->setCustomVar('_X_AMZN_TRACE_ID', $context->getTraceId());
$request->setCustomVar('LAMBDA_REQUEST_CONTEXT', json_encode($event->getRequestContext(), JSON_THROW_ON_ERROR));

$contentType = $event->getContentType();
Expand Down
1 change: 1 addition & 0 deletions tests/FpmRuntime/FpmHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,7 @@ private function assertCommonServerVariables(array $response, array $expectedGlo
'GATEWAY_INTERFACE' => 'FastCGI/1.0',
'FCGI_ROLE' => 'RESPONDER',
'LAMBDA_REQUEST_ID' => 'abc',
'_X_AMZN_TRACE_ID' => 'abc',
];

// Allow to override some keys
Expand Down
Loading