• Resolved t_mo

    (@t_mo)


    Hi there,

    I can’t get PHP to work. JS works fine, with the same or a different DSN ..
    I have both DSN setup inside my wp-config.php

    I had the sentry sdk installed via composer (inside my theme) before I installed your plugin, then I removed it again as I could not make your plugin work and I figured it could cause problems: composer remove sentry/sdk

    But I get the same message every time I try to send a test:
    PHP failed to send test event. Check your configuration to make sure your DSN is set correctly.

    I am on a local machine using MAMP PRO with PHP 7.4.12

    I don’t see any errors in my debug.log or php_error.log (in MAMP’s folder)

    Do you have any suggestion what else I could look out for?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author stayallive

    (@stayallive)

    Hi!

    You are not saying but it seems like you are on Windows. On Windows you need to set a correct certificate authority bundle file. I would assume MAMP PRO handles that correctly but it might not have or it might be out of date.

    I do not have Windows nor access to MAMP PRO but maybe this XAMPP instructions help to get it to work on MAMP too with some changes: https://stackoverflow.com/a/34883260/1580028.

    This should be a Windows specific issue, so you can also try it on a webserver to see if it does work there, Sentry should not be used locally anyway (but I understand you want to test it locally of course).

    Hope it helps!

    Thread Starter t_mo

    (@t_mo)

    Hi Alex, thanks for your quick response!

    Sorry I forgot to tell you my OS, but I’m on Mac (11.6.1)

    Plugin Author stayallive

    (@stayallive)

    Okay that is a pretty recent macOS install so I think we can rule that out.

    Unfortunately Sentry tries to eat as many errors it produces itself to prevent going into an infinite loop trying to records it’s own faults and failing etc. so that is why there is not much to go on.

    There is however a few ways to see what is going on under the hood.

    You have installed the plugin so you can go to this file (I’m assuming you are on the latest release here): wp-content/plugins/wp-sentry-integration/build/vendor/sentry/sentry/src/Transport/HttpTransport.php.

    On line 90 there should be a $this->logger->error call, right below or above that you can add your own debug statement, something like error_log(\sprintf('Failed to send the event to Sentry. Reason: "%s".', $exception->getMessage())) maybe. This could provide some more context on what the actual error is that was encountered trying to submit the event to the Sentry server.

    Thread Starter t_mo

    (@t_mo)

    Ok I’ve added the line you suggested and now an error appears in my debug.log:

    Failed to send the event to Sentry. Reason: "SSL certificate problem: certificate has expired".

    So yeah, it seems like sentry doesn’t accept the self-signed MAMP certificate.
    The same error appears when I delete the certificate from my host or use localhost instead of .test domain.

    • This reply was modified 3 years ago by t_mo.
    Plugin Author stayallive

    (@stayallive)

    Well, are you using a self-hosted Sentry instance?

    I’m assuming since the JS does work this is not the case and you are using sentry.io and/or your certificate on the self-hosted instance is just fine.

    But this problem is because of the recently expired Let’s Encrypt root. You can Google for this with MAMP and or macOS (but I think this is a MAMP thing having an outdated root certificate file or outdated OpenSSL version in PHP).

    The easiest solution for now (if you are using sentry.io) is to replace the o123456.ingest.sentry.io with just sentry.io in your DSN. This should solve the problem too (but do use the ingest endpoint whenever possible).

    Thread Starter t_mo

    (@t_mo)

    Hey Alex, it worked, thank you so much for walking me through this!

    The DSN for PHP now looks like this (yes I use sentry.io):

    https://[email protected]/1234567

    I could not find any useful information about the expired root certificate as you suggested, but am just happy that it works now as is. I will use the ingest endpoint on production.

    Thanks!

    • This reply was modified 3 years ago by t_mo.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP failed to send test event, JS works’ is closed to new replies.