2

I'm trying to deploy my firebase project, but Im getting the following error:

=== Deploying to 'my-proj'...

deploying firestore, functions, hosting

cloud.firestore: checking firestore.rules for compilation errors...

[W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]).

cloud.firestore: rules file firestore.rules compiled successfully

Error: Could not detect language for functions at

any thoughts?

Netzer
  • 37
  • 1
  • 9

5 Answers5

2

In my case, I missed functions init:

firebase init functions

documentation

2

In my case I use firebase deploy --only hosting command

Roman Soviak
  • 791
  • 2
  • 9
  • 30
0

I can't tell what else is perhaps going wrong with your code, but I also had an error that looked like this part:

[W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]).

Some of your firebase rules are written using version 1. You may need to go in and add

rules_version = '2';

to the top of your firebase rule set, specifically for Firebase Firestore. You can do this in the firebase console, or in the firestore.rules in your project - which may be a newly generated file in your project.

ImaRoxtaar
  • 231
  • 4
  • 8
0

Please update your rule to version 2 as the error message says.

Dev
  • 1,308
  • 3
  • 13
  • 24
0

For anyone else who ends up here. I had setup firebase static hosting 1yr+ ago, and at that point in time hosting was a "function". Since then, hosting is now a distinct offering separate of functions.

You need to convert the previous "default" function (which 'was' hosting) to hosting offering.

  1. Delete (or edit) firebase.json in the root directory of your firebase project.
  2. Firebase init hosting -> This will create a new "public" folder.
  3. Copy your previous functions/public folder to overwrite the new one.
  4. Delete the previous functions folder altogether.

Now hosting is fixed and you can deploy again.

  1. Firebase init functions -> This will create a new functions folder, and all of the boilerplate json and .js files.

The problem I was having is the functions folder had both hosting and functions stepping on each other within the functions directory. The "today" process puts hosting in a separate folder altogether.