Error: Socket timed out on request to sentry.io

Hi ,

I am receiving this error when using an example code:

var app = require(‘express’)();
var Raven = require(‘raven’);

// Must configure Raven before doing anything else with it
Raven.config(’’).install();

// The request handler must be the first middleware on the app
app.use(Raven.requestHandler());

The error is:
raven@2.0.1 alert: failed to send exception to sentry: Socket timed out on request to sentry.io
raven@2.0.1 alert: failed to send exception to sentry: Socket timed out on request to sentry.io
TypeError: app.use() requires middleware functions

The DSN is copied from the Client Keys page of the Project settings.

What could be the problem? And how could it be fixed?

Thanks.
Irena

What version of express are you using?

If I run the code you’ve provided here, I get no output and a simple run-to-completion exit, which is what I would expect. Can you post a more complete reproduction?

I have no idea where the TypeError: app.use() requires middleware functions bit is coming from, but you might be able to alleviate the timed out error by increasing the sendTimeout config parameter:

Raven.config(dsn, { sendTimeout: 5 }).install();

It defaults to 1 (second); I don’t know why anything would be exceeding this, but if it is happening, you can increase the timeout as shown. It could also just be a network problem.

Thank you for responding to this issue. I cannot reproduce the problem any longer, so cannot provide more details.
Thanks for looking into it anyway.