Closed
Description
Environment info
firebase-tools:
firebase-tools@6.7.2
Platform:
MacOS
Test case
MacOS, Node 10.15.3, firebase-tools@6.7.2
Steps to reproduce
Create two hosting sites on firebase console.
Run
'firebase target:apply hosting dev firebase-hosting-id'
Run
'firebase deploy --only hosting:dev'
Expected behavior
Deployment successful
Actual behavior
[info] Project Console: https://console.firebase.google.com/project/project-name/overview
[debug] [2019-05-01T19:12:12.726Z] TypeError: Cannot read property 'deploys' of undefined
at /Users/reeda/.nvm/versions/node/v10.15.3/lib/node_modules/firebase-tools/lib/deploy/index.js:88:36
at process._tickCallback (internal/process/next_tick.js:68:7)
[error]
[error] Error: An unexpected error has occurred.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
bkendall commentedon May 1, 2019
There's been some adjustments in this flow recently. This error is coming from (in the source): https://github.com/firebase/firebase-tools/blob/master/src/deploy/index.js#L111
@Memeriaj can you take a look as you've been dealing with this lately?
Memeriaj commentedon May 2, 2019
I think I may know what is going on here. Does your
firebase.json
config file have"target": "dev"
in it? I believe that we filtered out all of the configs that didn't matchhosintg:dev
and we were left with an empty array. We then went through all of the deploy steps for that empty array, effectively doing nothing. Then at the end we display the console link and the link to your newly deployed Hosting Site, which is where this error pops up because we didn't actually deploy anything.We definitely need a proper error in this case explaining that we're not deploying anything.
(unrelated to the issue: generally you want to have your environment level switching be on a Firebase project level basis and not on different Hosting Sites within the same project (though you might have a Site for a blog, a Site for a web app, and a Site for your Docs that are all in the same environment on different Hosting Sites on the same project). This is mainly because things like Firebase Auth have only a single instance within a project. Ideally your
firebase.json
file is set up in such a way that you'd be able to something likefirebase use dev
,firebase deploy
, check dev to make sure things are working,firebase use staging
,firebase deploy
, ...)Reedyuk commentedon May 3, 2019
{ "firestore": { "rules": "firestore.rules", "indexes": "firestore.indexes.json" }, "hosting": { "public": "build", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] }, "functions": { "predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint" ] } }
Reedyuk commentedon May 3, 2019
I think the config you mention is in the firebase bashrc file and not the firebase json file.
Memeriaj commentedon May 3, 2019
Under the hosting section of the firebase.json file you need to have
"target": "dev"
in order forfirebase deploy --only hosting:dev
to work. The--only
flag works like a filter and without thetarget
field in your Hosting configuration then the CLI is not deploying anything (which should be an error with a useful message, but right now just blindly accepts it).Reedyuk commentedon May 3, 2019
Sorry, its not clear where in the json to put the target field, would i put this at the root of the json(it didnt work) or should it be in the root of the hosting(also didnt work for me).
Reedyuk commentedon May 3, 2019
Also my firebaserc file, references my root project but it doesnt have any reference to the my second hosting site, so im not sure how the CLI tool will be able to understand where to deploy to.
43 remaining items