Closed victorronnow closed 1 year ago
So it seems that exceptions need to be logged manually when using Slim. I resolved it, by using brefphp/logger
and tweaking my custom ErrorHandler. Now the errors are logged in Cloudwatch.
// ErrorHandler.php
public function __invoke(ServerRequestInterface $request, Throwable $exception)
{
...
$logger = new \Bref\Logger\StderrLogger();
$logger->error('Error', ['exception' => $exception]);
...
throw $exception;
}
// app.php
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
$errorMiddleware->setDefaultErrorHandler(new ErrorHandler(...));
Description:
I've deployed my Slim PHP web app using
$ serverless deploy
with the following configuration inserverless.yml
:When accessing my app, I get a blank page with a
500 error
response. I've tried to log the php errors with$ serverless logs -f app
, but I only receive the following information with no PHP errors, which I need to resolve the issue: