-
-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Brefv2 500 Errors Not In Logs #1794
Comments
With the FPM runtime, just like on any server, nothing is logged by default. You have to set up an error handler. You can use a framework or a library like Monolog. |
Hi @mnapoli - First, I implemented bref logger with brefv1: https://github.com/brefphp/logger The issue is with native PHP errors for example things that result in default 500 http response codes (fatal exceptions, syntax errors, etc) are not visible in cloudwatch logs. According to the documentation here: https://bref.sh/docs/environment/logs "By default, all PHP errors, warnings and notices emitted by PHP will be forwarded into CloudWatch. That means that you don't have to configure anything to log errors, warnings or uncaught exceptions." With v1, I didn't need to do anything to get this to show up in the logs. Here is an example of a request served by the php-fpm-83 runtime in v2 that results in a 500 error (because it is in fact a syntax error), but it doesn't show up in the cloudwatch logs Could you help point me to what I'm missing? |
I was able to reproduce the v1 behavior by creating a custom php.ini file in my project and adding these settings. ; Turn off displaying errors ; Log errors to the server's error log (stderr) ; Set the level of error reporting |
I'm going to reopen this because I'm not sure whether we want to change that, I want to keep the idea in mind. |
I think it would make sense, at the very least, to have this as a reminder in the documentation for people getting started. Especially if they are coming into this from a background where php-fpm wasn't what they were using (as was in my case). |
Description:
Since upgrading to brefv2, i'm no longer seeing error messages in the cloudwatch logs.
For example:
This only started happening after the upgrade from brefv1 to brefv2.
Am I doing something wrong?
serverless.yml
plugins:
- ./vendor/bref/bref
- ./vendor/bref/extra-php-extensions
functions:
api:
handler: lambdaHandler.php
description: ''
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
memorySize: 256
runtime: php-83-fpm
layers:
- ${bref-extra:redis-php-83}
events:
- httpApi: '*'
The text was updated successfully, but these errors were encountered: