Search code examples
reactjsdjangogoogle-app-enginenext.js

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


I have created nextjs project with Isomorphic admin theme

Now I am going to deploy this project to google app engine. I read this discussion and structured my app based on this repo

This is my app.yaml

env: standard
runtime: nodejs14
service: default

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

and my package.json file

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

I added build dir and deployed to google app engine,but it shows 500 error.

  1. Where can i check server error log? I guess that nodejs server didn't start correctly, but no way to check error message.
  2. Should I use cloud-build and build-triggers to automate deployment on github commit? What is the best approach to deploy nextjs project to app engine?

Solution

  • To view your logs in Production,

    1. Login to Google Cloud Console i.e. https://console.cloud.google.com
    2. Click the hamburger menu icon (the 3 short horizontal rows) and in the drop down, look for Operations and under it Logging
    3. Select legacy log viewer