Search code examples
javascriptfirebasefirebase-securityfirebase-realtime-databasefirebase-hosting

'firebase deploy' compilation error in storage.rules


I am trying to deploy the firebase app from here and I am following this tutorial. I would like to deploy my firebase app. However, when I enter

firebase deploy

I get an error. Here are my logs:

egaumbp:web gg$ firebase deploy

=== Deploying to 'friendlychat-6e4c3'...

i  deploying database, storage, hosting
i  storage: checking rules for compilation errors...

Error: Compilation error in storage.rules:

[E] 3:12 - Unexpected '<'.
egaumbp:web gg$ 

I am logged in, and I have version 3.0.0 of the firebase toolkit, and I am doing this from a MacBook Pro (Retina, 13-inch, Late 2012), on OSX EL Capitan Version 10.11.2.


Solution

  • Many of the examples in the getting started guide use a convention of <placeholder> where the developer needs to provide some additional information to make the example function. In the first example from Understanding Firebase Storage Security Rules, the following code snippet is presented with the placeholder <your-firebase-storage-bucket>.

    service firebase.storage {
      match /b/<your-firebase-storage-bucket>/o {
        // ... more rules ...
      } 
    }
    

    To fix the Unexpected '<' error in this case, replace the placeholder with friendlychat-6e4c3.appspot.com like so:

    service firebase.storage {
      match /b/friendlychat-6e4c3.appspot.com/o {
        // ... more rules ...
      } 
    }
    

    A detailed overview of the supported syntax and functions is available at Learn to Secure Files. It's a good reference if you encounter more compilation errors.