SheppardDigital
SheppardDigital

Reputation: 3255

Firebase hosting deploy - Cannot read property 'deploys' of undefined

I'm trying to deploy an angular app to Firebase. Firebase is setup to host multiple sites.

In Firebase, the project name is 'myapp-staging-84e3e'. There are two sites setup in Firebase which are 'myapp-admin-staging' and 'myapp-staging-84e3e'. I'm trying to deploy this app to 'myapp-admin-staging'.

When I try to run firebase deploy --only hosting:admin I get the following error in firebase-debug.log;

[debug] [2020-08-24T15:19:23.581Z] TypeError: Cannot read property 'deploys' of undefined
    at /usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:84:36
    at processTicksAndRejections (internal/process/task_queues.js:82:5)
[error] 
[error] Error: An unexpected error has occurred.

I must have something setup incorrectly but I can't determine what it is. My .firebaserc file looks like this;

    {
  "targets": {
    "myapp-staging-84e3e": {
      "hosting": {
        "admin": [
          "myapp-admin-staging"
        ]
      }
    }
  },
  "projects": {
    "default": "myapp-staging-84e3e"
  }
}

Then the firebase.json file looks like this;

{
  "hosting": {
    "public": "dist/MyApp-Admin",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

Where am I going wrong?

Upvotes: 1

Views: 1061

Answers (1)

Tomi Gelo
Tomi Gelo

Reputation: 97

You need to add "target": "admin" to your firebase.json so that it looks like this:

{
  "hosting": {
    "target": "admin", //added
    "public": "dist/MyApp-Admin",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

Upvotes: 1

Related Questions