gugus
gugus

Reputation: 17

Cloud Build Trigger - Not in Firebase app directory error

I have problem with deploying node.js (Angular) application from Bitbucket repository to Firebase using Cloud Build Trigger. I performed steps from this article - https://cloud.google.com/build/docs/deploying-builds/deploy-firebase

Problem is that after running Cloud Build Trigger I receive following error: "Error: Not in Firebase app directory (could not locate firebase.json)"

What could be reason of such error? Is it possible to point to the trigger where in repository is firebase application and firebase.json file?

EDIT:
My cloudbuild.json file is quite simple:

{
  "steps": [
   {
      "name": "gcr.io/PROJECT_NAME/firebase",
      "args": [
         "deploy",
         "--project",
         "PROJECT_NAME",
         "--only",
         "functions"
       ]
  }
  ]
}

Logs in Cloud Build Trigger history:

  starting build "build_id"

FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/link
 * branch            branch_id -> FETCH_HEAD
HEAD is now at d8bc2f1 Add cloudbuild.json file
BUILD
Pulling image: gcr.io/PROJECT/firebase
Using default tag: latest
latest: Pulling PROJECT/firebase
1e987daa2432: Already exists
a0edb687a3da: Already exists
6891892cc2ec: Already exists
684eb726ddc5: Already exists
b0af097f0da6: Already exists
154aee36a7da: Already exists
37e5835696f7: Pulling fs layer
62eb6e670f1d: Pulling fs layer
47e62615d9f9: Pulling fs layer
428cea824ccd: Pulling fs layer
765a2c722bf9: Pulling fs layer
b3f5d0a285e3: Pulling fs layer
428cea824ccd: Waiting
765a2c722bf9: Waiting
b3f5d0a285e3: Waiting
47e62615d9f9: Verifying Checksum
47e62615d9f9: Download complete
62eb6e670f1d: Verifying Checksum
62eb6e670f1d: Download complete
765a2c722bf9: Verifying Checksum
765a2c722bf9: Download complete
b3f5d0a285e3: Verifying Checksum
b3f5d0a285e3: Download complete
37e5835696f7: Verifying Checksum
37e5835696f7: Download complete
428cea824ccd: Verifying Checksum
428cea824ccd: Download complete
37e5835696f7: Pull complete
62eb6e670f1d: Pull complete
47e62615d9f9: Pull complete
428cea824ccd: Pull complete
765a2c722bf9: Pull complete
b3f5d0a285e3: Pull complete
Digest: sha256:4b6b7214d6344c8247130bf3f5443a2851e39aed3ececb32dfb2cc25a5c07e44
Status: Downloaded newer image for gcr.io/PROJECT/firebase:latest
gcr.io/PROJECT/firebase:latest

Error: Not in a Firebase app directory (could not locate firebase.json)
ERROR
ERROR: build step 0 "gcr.io/PROJECT/firebase" failed: step exited with non-zero status: 1

Firebase.json file is placed in repository in following path: /apps/firebase/firebase.json I can't see any possibility to point that path in Cloud Build Trigger config.

Upvotes: 0

Views: 642

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75715

I'm pretty sure that you aren't in the correct directory when you run the command. To check this, you can add this step

{
  "steps": [
   {
      "name": "gcr.io/cloud-builders/gcloud",
      "entrypoint":"ls"
      "args": ["-la"]
  }
  ]
}

If you aren't in the correct directory, and you need to be in the ./app/firebase to run your deploy, you can add this parameter in your step

{
  "steps": [
   {
      "name": "gcr.io/PROJECT_NAME/firebase",
      "dir": "app/firebase",
      "args": [
         "deploy",
         "--project",
         "PROJECT_NAME",
         "--only",
         "functions"
       ]
  }
  ]
}

Let me know if it's better

Upvotes: 2

Related Questions