Skip to content

error-reporting: Errors not sent when providing an API key only #2302

@DominicKramer

Description

@DominicKramer
  • 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.

Metadata

Metadata

Assignees

Labels

api: error-reportingpriority: p2Moderately-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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions