Expose the LAMBDA_REQUEST_ID variable in PHP-FPM too - #2189
Merged
Merged
Conversation
This was referenced Sep 26, 2026
The function and console runtimes set it on every invocation, PHP-FPM workers only received LAMBDA_INVOCATION_CONTEXT. Claude-Session: https://claude.ai/code/session_0168N55uBK9UjfpL6r8oGjDm
mnapoli
force-pushed
the
request-id-in-logs
branch
from
September 26, 2026 18:58
c9e0d0d to
d97ec03
Compare
LAMBDA_REQUEST_ID in PHP-FPM too
LAMBDA_REQUEST_ID in PHP-FPM tooLAMBDA_REQUEST_ID variable in PHP-FPM too
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The function and console runtimes set
LAMBDA_REQUEST_IDon every invocation (#2035), and the docs say Bref sets it on "every Lambda invocation", but PHP-FPM workers only receivedLAMBDA_INVOCATION_CONTEXT(JSON). This passesLAMBDA_REQUEST_IDto PHP-FPM too, so$_SERVER['LAMBDA_REQUEST_ID'](andgetenv()) works the same in every runtime. Documented infpm-runtime.mdx. See brefphp/laravel-bridge#145 for users looking for the ID.That lets Bref's log formatters start every line with the request ID in PHP-FPM too: brefphp/monolog-bridge#2 and brefphp/logger#12. The documentation of the logs of a single request is in #2190.
Tested on AWS with a Laravel application (PHP-FPM, Octane, queue worker, console) using this branch and the monolog-bridge branch. For a PHP-FPM request that timed out, one
filter @requestId = '…'query in Logs Insights returns: