簡體   English   中英

如何在 App Engine 標准環境 (Node.js) 中設置 Google Cloud 錯誤報告?

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

文檔中它說

注意:寫入 stderr 的錯誤日志由錯誤報告自動處理,無需直接使用 Node.js 的錯誤報告庫。

因此,我的應用程序(Node.js 14,App Engine 標准環境)將錯誤記錄到stderr ,我可以在 Google Cloud Logging 儀表板中看到它們。

在此處輸入圖像描述

// 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"
}

但這並沒有在Google Cloud 錯誤報告儀表板( 儀表板)中報告。

我認為錯誤報告器會自動使用 App Engine stderr錯誤。

您提到的評論位於“App Engine 靈活環境”部分下,並且您正在使用 App Engine 標准環境。 該文檔說 - 您可以在以下 Google Cloud 環境中為 Node.js 配置錯誤報告 - 並且未列出 App Engine 標准。 因此,標准可能不支持 API,或者您必須為標准顯式配置它

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM