-
Notifications
You must be signed in to change notification settings - Fork 640
Closed
Labels
api: error-reportingpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
- I ran
export NODE_ENV=production - I installed express and cloud-errors.
- I run the following code:
I could not see errors in the Error Reporting UI for this project.
I could successfully send manually errors to this project with this API key (by calling the API from cURL).
var express = require('express');
var app = express();
var errorHandler = require('@google/cloud-errors')({
projectId: "<my project>",
key: "<my api key>",
serviceContext: {
service: 'steren-test-node',
version: 'test1'
}
});
app.get(
'/errorRoute',
function ( req, res, next ) {
// You can push in errors manually
res.send("Error");
res.end();
next(new Error("Got traffic on the errorRoute"));
}
);
app.get(
'/anotherRoute',
function ( req, res, next ) {
// It'll even log potentially unexpected errors
JSON.parse("{\"malformedJson\": true");
}
)
// Just use the express plugin
app.use(errorHandler.express);
app.listen(
3000
, function ( ) {
console.log('Server has been started on port 3000');
}
);
This issue has been migrated from the cloud-errors-nodejs issue #10.
ivanseidel
Metadata
Metadata
Assignees
Labels
api: error-reportingpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.