-
-
Notifications
You must be signed in to change notification settings - Fork 135
Auto-breadcrumbs causes getContext warning #250
Comments
Yea, definitely makes sense that in this scenario you'd see that warning given the current implementation. It's a pretty reasonable use on your part, though. A few options here:
var app = require('express')();
var Raven = require('raven');
var __DSN__ = 'https://....@sentry.io/....';
Raven.config(__DSN__, {autoBreadcrumbs:{console:true}}).install();
Raven.context(function () {
console.log('Starting server ... etc.'); // Is this a crime? :'-(
app.use(Raven.requestHandler());
app.get('/', function mainHandler(req, res) {
throw new Error('Broke!');
});
app.use(Raven.errorHandler());
app.use(function onError(err, req, res, next) {
res.statusCode = 500;
res.end(res.sentry + '\n');
});
app.listen(3000);
});
Either way, I should probably add a bit to the docs on "if you're getting console alert xyz, here are things you might be doing to cause it"; I added this alert to make sure people don't try to |
@LewisJEllis, is there be a way to keep the functionality as is but changing the internals so that logging to the console doesn't trigger the alert? It would seem that internal calls could have a flag that suppresses the alert. |
I made I'm going to keep this open for now until I improve the docs to help avoid users accidentally botching the setup and getting confused when they have global breadcrumbs doing weird things. |
This issue shouldn't be relevant in v2 anymore (OP used v1.1.1 for the report). |
My primary use case for the raven client lib is in an Express(3) app, and it works fine even with
{autoBreadcrumbs:true}
but this causes warnings on the console like below:I concluded that it was because at startup, before and after I have instantiated the Express app, I need to write some messages to the console. I recreated the error, using the Express example with the addition of one
console.log()
call:Is there any way to use console.log outside of the Express app context like this, without this warning? Reporting and everything seems to work fine, (even console calls!). Please advice.
The text was updated successfully, but these errors were encountered: