Search code examples
google-app-enginenestjsgoogle-cloud-build

Module not found in Nest JS after deploying to App engine


I tried to deploy a Nest JS app to App Engine through Google Build Cloud & Manually Both tries gives same error Modules not found

Error when deploying manually through Shell

Error when dploying using clouf build

My cloudbuild.yaml

  - name: node:14.15.1
    entrypoint: npm
    args: ["install"]
  - name: node:14.15.1
    entrypoint: npm
    args: ["run", "build"]
  - name: node:14.15.1
    entrypoint: npm
    args: ["run", "create-env"]
    env:
      - "_APP_LUNE_DEV_TOKEN=${_APP_LUNE_DEV_TOKEN}"
      - "_BUCKET_NAME=${_BUCKET_NAME}"
      - "_FIREBASE_API_KEY=${_FIREBASE_API_KEY}"
      - "_FIREBASE_APP_ID=${_FIREBASE_APP_ID}"
      - "_FIREBASE_AUTH_DOMAIN=${_FIREBASE_AUTH_DOMAIN}"
      - "_FIREBASE_MESSAGING_SENDER_ID=${_FIREBASE_MESSAGING_SENDER_ID}"
      - "_FIREBASE_PROJECT_ID=${_FIREBASE_PROJECT_ID}"
      - "_FIREBASE_STORAGE_BUCKET=${_FIREBASE_STORAGE_BUCKET}"
      - "_GOOGLE_APPLICATION_CREDENTIALS=${_GOOGLE_APPLICATION_CREDENTIALS}"
      - "_LUNE_API_BASE_URL=${_LUNE_API_BASE_URL}"
      - "_STRIPE_SECRET_KEY=${_STRIPE_SECRET_KEY}"
  - name: "gcr.io/cloud-builders/gcloud"
    args: ["app", "deploy"]
timeout: "1600s"
options:
  logging: CLOUD_LOGGING_ONLY

My app.yaml

runtime: nodejs14

service: backend

What I'm doing wrong ?


Solution

  • The problem was caused by Nest Js CLI Aliases, When I changed src/example/service to ../example/service the deployment worked It's recommended to use typescript aliases in tsconfig file instead of CLI