Nuxt 2 deploying to Google App Engine - Error: Page not found

83 Views Asked by At

When using npm run dev and npm run start, my application runs correctly on the local server. When I use npm run build and npm run generate, my app builds and generates routes with no errors. I am able to gcloud app deploy app.yaml to my google cloud project with no issues. My google app engine versions shows that it is serving on nodejs12. However, when I go to the app link, I am met with 'Error: Page not found The requested URL was not found on this server.'

Here is my app.yaml file:

runtime: nodejs12

instance_class: F2

handlers:
  - url: /_nuxt
    static_dir: /static
    secure: always

  - url: /(.*\.(gif|png|jpg|ico|txt))$
    static_files: /static/index.html
    upload: index.html
    secure: always

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

env_variables:
  HOST: '0.0.0.0'

In my nuxt.config.js, I have values set to target: 'static', pages: 'true', and ssr: 'false' .

When running gcloud app logs tail I get the error Error: Cannot find module '/workspace/server.js' .

My npm version is 6.14.6, node js is 12.22.12 and nuxt is 2.17.1.

I'm relatively new to nuxt and I'm using nuxt 2 because there is more documentation here on google app engine deployment. However, I'm facing a lot of issues and everything I try seems to fail. Any help or suggestions would be appreciated.

0

There are 0 best solutions below