如何查看部署在google App Engine标准环境下的nexjs项目日志?

How to check logs of nexjs project deployed in google app engine standard environment?

我已经用 Isomorphic admin theme

创建了 nextjs 项目

现在我要将此项目部署到 google 应用引擎。 我读了这个discussion and structured my app based on this repo

这是我的app.yaml

env: standard
runtime: nodejs14
service: default

handlers:
  - url: /.*
    secure: always
    script: auto

和我的 package.json 文件

... ...
"scripts": {
    "dev": "next -p 3030",
    "start": "next start",
    "serve": "next start",
    "build": "rimraf build && next build",
    "deploy": "gcloud app deploy --project [Project-ID]",
    "analyze": "cross-env ANALYZE=1 next build",
    "heroku-postbuild": "npm run build"
  }
... ...

我添加了构建目录并部署到 google 应用引擎,但它显示 500 错误。

  1. 在哪里可以查看服务器错误日志? 我猜是 nodejs 服务器没有正确启动,但无法检查错误消息。
  2. 我应该使用 cloud-build 和 build-triggers 在 github 提交时自动部署吗? 将 nextjs 项目部署到 App Engine 的最佳方法是什么?

要在生产环境中查看您的日志,

  1. 登录到 Google Cloud Console 即 https://console.cloud.google.com
  2. 单击汉堡菜单图标(3 个短水平行)并在下拉菜单中查找操作并在其下方 Logging
  3. Select legacy log viewer