Production environments don't send errors, but development does (Laravel)

arktik

Posted on
Sep 21 2015

Hello,

Raygun is great but it doesn't really work for us. We have a PHP Laravel 4.2 app, on our local Vagrant machines everything works great, but on our live environments (test, beta and live) the errors don't make it to raygun. We've integrated it using the instructions at https://packagist.org/packages/davibennun/laravel-raygun

The OS is the same, the entire environment is pretty much the same, but we're not getting the errors on the production environments. The only main difference is that we have HTTPS on production. Would that be an issue?

Regards, Arktik Team.


Callum

Posted on
Sep 22 2015

Could you please confirm that cURL is installed and enabled in the PHP installation on your production server? This is a required dependency when using async mode. The case may be that the underlying Raygun4PHP is attempting to send using cURL when it is not available. I note that it is possible to change the async setting in your laravel-raygun config, so alternatively setting it to false will avoid the cURL dependency and send errors using a socket connection instead.

Unfortunately laravel-raygun is a third-party provider which we didn't implement, and it appears there are confusing defaults here. We have an official Laravel provider planned in the medium term but hopefully the above gets it working for you in the meantime.


Jamie Penney

Posted on
Sep 22 2015

Hi team,

The usual answer to this question is "check your firewall" but that's usually only an issue in large corporates with very locked down servers. The use of HTTPS on your site should make a difference to the Raygun library.

Can you SSH into the VM running your app, then run curl https://api.raygun.io/healthcheck and verify that it returns "{}". If that works, your server is able to open a connection to the Raygun API, so something else is wrong. If not, then something on your server will be blocking the connection.

Sorry I don't have any more concrete advice, it's always hard to tell what's wrong with a production setup.

Cheers, Jamie


arktik

Posted on
Sep 22 2015

Hi Jamie, Callum,

Thanks for getting back to us. cURL is enabled and the firewall is disabled:

root@staging:~# curl https://api.raygun.io/healthcheck
{}root@staging:~# php -m | grep curl
curl
root@staging:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
root@staging:~#

Laravel 4.2's point of inserting a handler, as indicated, is where the logging is made, in app/start/global.php:

App::error(function(Exception $exception, $code)
{
    Log::error($exception);
    Raygun::sendException($exception);
});

Interesting is that errors are being logged in production, but RayGun fails, which doesn't make sense to me. I've also checked the php error log for some other error that Raygun would fire, but there's nothing, everything works out. And regarding the environment type, we have one of them configured just like development, will full errors and everything, so it's pretty darn the same as the local one. I previously tried with the default PHP integration, but that doesn't work out-of-the-box since Laravel overwrites the handlers.

I don't really know what else to try, where to debug.

Cheers, The Arktik Team


Reply