Skip to content

Commit

Permalink
Merge pull request #1699 from brefphp/log-invocation-id
Browse files Browse the repository at this point in the history
Add the invocation ID to the logs to facilitate debugging
  • Loading branch information
mnapoli authored Nov 24, 2023
2 parents ca85b27 + 99309fa commit 2a6cd25
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/FpmRuntime/FpmHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public function handleRequest(HttpRequestEvent $event, Context $context): HttpRe

$response = $this->client->readResponse($socketId, $timeoutDelayInMs);
} catch (TimedoutException) {
echo "The PHP script timed out. Bref will now restart PHP-FPM to start from a clean slate and flush the PHP logs.\nTimeouts can happen for example when trying to connect to a remote API or database, if this happens continuously check for those.\nIf you are using a RDS database, read this: https://bref.sh/docs/environment/database.html#accessing-the-internet\n";
$invocationId = $context->getAwsRequestId();
echo "$invocationId The PHP script timed out. Bref will now restart PHP-FPM to start from a clean slate and flush the PHP logs.\nTimeouts can happen for example when trying to connect to a remote API or database, if this happens continuously check for those.\nIf you are using a RDS database, read this: https://bref.sh/docs/environment/database.html#accessing-the-internet\n";

/**
* Restart FPM so that the blocked script is 100% terminated and that its logs are flushed to stderr.
Expand Down

0 comments on commit 2a6cd25

Please sign in to comment.