google-app-enginegoogle-cloud-platformgoogle-cloud-logginggoogle-cloud-error-reporting

How to setup Google Cloud Error Reporting in App Engine standard environment (Node.js)?


In the docs it says

Note: Error logs written to stderr are processed automatically by Error Reporting, without needing to use the Error Reporting library for Node.js directly.

Thus, I my application (Node.js 14, App Engine standard environment) logs errors to stderr and I can see them at Google Cloud Logging dashboard.

enter image description here

// Error Object
{
  "insertId": "60b9efa000007121b8631531",
  "jsonPayload": {
    "type": "Error",
    "pid": 10,
    "level": 50,
    "stack": "Error: test\n    at Object.<anonymous> (/workspace/dist/utils/logger.js:39:22)\n    at Module._compile (internal/modules/cjs/loader.js:1068:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)\n    at Module.load (internal/modules/cjs/loader.js:933:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:774:14)\n    at Module.require (internal/modules/cjs/loader.js:957:19)\n    at require (internal/modules/cjs/helpers.js:88:18)\n    at Object.<anonymous> (/workspace/dist/routes/product-category/edit.js:8:18)\n    at Module._compile (internal/modules/cjs/loader.js:1068:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)",
    "message": "o noo",
    "time": 1622798240028,
    "hostname": "localhost"
  },
  "resource": {
    "type": "gae_app",
    "labels": {
      "project_id": "xxx",
      "zone": "us17",
      "module_id": "default",
      "version_id": "20210604t091336"
    }
  },
  "timestamp": "2021-06-04T09:17:20.028961Z",
  "severity": "ERROR",
  "labels": {
    "clone_id": "00c61b117c4c0ddc91320383c7a1462a90cff4d4f94ba3ec8a2e77217475dd58d4a633941d95a17ff0c2889faffc45f43561f51fad7d5a16bd1e38a1fba05e65fc70fdd43ec7"
  },
  "logName": "projects/xxx/logs/stderr",
  "receiveTimestamp": "2021-06-04T09:17:20.046939477Z"
}

But this is not being reported in Google Cloud Error Reporting dashboard (dashboard).

I thought App Engine stderr will be automatically utilized by the Error Reporter.


Solution

  • The comment you referred to is under the section for 'App Engine Flexible Environment' and you are working in App Engine Standard Env. That document says - You can configure Error Reporting for Node.js on the following Google Cloud environments - and App Engine standard is not listed. Thus it is possible the API is not supported for standard or you have to explicitly configure it for standard