Next.js Discord

Discord Forum

How to properly deploy Nextjs 13 (app router feature) into gcloud?

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
Hi I deployed my nextjs 13 app with app router feature into google cloud. Everything is packed into docker and deployed properly, but I receive such an error:

Error: > Couldn't find any pages or app directory. Please create one under the project root
at findPagesDir (/app/node_modules/next/dist/lib/find-pages-dir.js:94:15)
at DevServer.getRoutes (/app/node_modules/next/dist/server/dev/next-dev-server.js:193:71)
at new Server (/app/node_modules/next/dist/server/base-server.js:192:47)
at new NextNodeServer (/app/node_modules/next/dist/server/next-server.js:172:9)
at new DevServer (/app/node_modules/next/dist/server/dev/next-dev-server.js:151:9)
at NextServer.createServer (/app/node_modules/next/dist/server/next.js:179:24)
at /app/node_modules/next/dist/server/next.js:200:42
at async NextServer.prepare (/app/node_modules/next/dist/server/next.js:160:24)
at async Server.<anonymous> (/app/node_modules/next/dist/server/lib/render-server.js:123:17)

Anybody knows what is going on with that ? or Google Cloud is not supporting app router yet ?

Docker is working fine locally atm and there is no issue with that.

7 Replies

what's type of gcloud? GAE Flex, Cloud Run, Kubernetes or Compute Engine?
make sure this. NODE_ENV=production
most probably ENV variables
Spectacled bearOP
what do you mean by env variables ?
I'm using Cloud Run
Spectacled bearOP
Then you tell me that in gcloud cloud run I need to specify env, correct ?
and when I add one new one then it should be the name ENV with the value production or development regarding to version ?