- Issue created by @RoSk0
- Status changed to Postponed: needs info
10 months ago 6:20am 8 July 2024 - πΊπΈUnited States mfb San Francisco
@RoSk0 it works for me. Did you verify that
$_SERVER['SENTRY_DSN']
, etc. are in fact set in your environment?Are you using the
symfony/dotenv
orvlucas/phpdotenv
package to manage your environment variables, or custom code? If custom code, make sure you are in fact setting$_SERVER['SENTRY_DSN']
, etc. - πΊπΈUnited States mfb San Francisco
A command-line check to verify this is working:
SENTRY_ENVIRONMENT=mic-check ./vendor/bin/drush status-report | grep Sentry\ environment
prints:
Sentry environment Info mic-check
- π³πΏNew Zealand RoSk0 Wellington
I've done a bit more digging and this is what I observe:
www-data@31b009f0b41c:~$ env|grep ^SENTRY SENTRY_ENVIRONMENT=development SENTRY_DSN=****************************************** SENTRY_RELEASE=test-local-release www-data@31b009f0b41c:~$ drush status-report | grep 'Sentry release' Sentry release Info test-local-release
Drupal status report still says
- Sentry DSN - NULL Sentry client key is not configured. No events will be sent to Sentry.
- Sentry environment - prod
I've set
$settings['sa_core_2023_004_phpinfo_flags']
toINFO_ALL
and now can clearly see the the problem comes from the Apache -Environment
ofphpinfo()
output hasSENTRY_DSN
environment variable as well as$_ENV
, but not$_SERVER
.At the same time,
getenv('SENTRY_DSN')
returns the correct value when executed via Apache.It's clearly not a bug of this module, but rather a standard behaviour of the webserver in question.
Apache documentation mentions that on the first lines here https://httpd.apache.org/docs/current/env.html :
First, there are the environment variables controlled by the underlying operating system. These are set before the server starts. They can be used in expansions in configuration files, and can optionally be passed to CGI scripts and SSI using the PassEnv directive.
I think it would be good to add some notes to the documentation to mention this Apache behaviour, but I will leave it to your discretion.
- πΊπΈUnited States mfb San Francisco
Documenting how environment variables work feels a bit out of scope, since it changes so much depending on the environment, but if someone wants to contribute a documentation merge request I can look at it.
- Status changed to Closed: cannot reproduce
8 months ago 7:54pm 2 September 2024 - πΊπΈUnited States mfb San Francisco
Closing for now but feel free to re-open if anyone wants to suggest documentation improvements