Deployed a Next.js application to App Engine Standard [Nodejs] and got a 500 error

前端 未结 3 2030
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 18:45

I deployed to app engine with nodejs8 runtime and got a 500. Im deploying a next.js application, and upon reviewing StackDriver I get. It appears .next might be getting ignored.

3条回答
  •  无人及你
    2021-02-04 19:12

    I've just managed to make it work. Here's what I found:

    First of all, it doesn't work with Yarn. It seems gcp-build command does not run when there is yarn.lock file.

    Now in package.json, use following scripts:

      "scripts": {
        "gcp-build": "next build",
        "start": "next start -p $PORT"
      }
    

    And make sure to declare Next and all modules needed in next.config.js as dependencies (not devDependencies)

    FYI I only have runtime: nodejs10 in my app.yaml and only scripts I have are in pages folder and next.config.js

提交回复
热议问题