Adam Mikacich
Adam Mikacich

Reputation: 136

Firebase deployment error

I've deployed in the past many times before. For some reason, today I am getting this error I can't seem to fix. I've tried changing tabs out with 2 or 4 spaces. I've tried different formats, and nothing works.

Here's what it says:

Error: There was an error loading firebase.json

Trailing comma in object at 29:9
    }
    ^

Here is my firebase.json

{
    "database": {
        "rules": "database.rules.json"
    },
    "hosting": {
        "public": "public"
    }
}

How do I solve it?

PS: If you need anything else please ask.

Upvotes: 10

Views: 15034

Answers (6)

user3024215
user3024215

Reputation: 196

In my case it was showing this error in firebase.json file but I didn't find any error there and so I checked databaserules.json file and shown error was there. I corrected it and it worked.

Upvotes: 0

user7730235
user7730235

Reputation: 61

This error is caused by invalid JSON format within database.rules.json file. First, open a database.rules.json file. move to the end of line in the file. remove ',' at last position of the line.

Upvotes: 6

user1211030
user1211030

Reputation: 3040

Check if your database.rules.json has valid json format.

Upvotes: 0

Guy
Guy

Reputation: 13286

This error means the JSON format of the database.json is invalid. Simply go to the line specified, 29 in your case, and remove the comma to make the JSON valid. JSON files do not allow trailing commas.

Upvotes: 0

eyeezzi
eyeezzi

Reputation: 635

To anyone experiencing this problem, I solved mine by going to the file "database.rules.json", and removing the last comma in the line ".write": true,

{
  "rules": {
    ".read": true,
    ".write": true,
  }
}

It seems Firebase generated an invalid JSON.

Upvotes: 11

Chriskot
Chriskot

Reputation: 647

Change your firebase json file to

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "public",
    "rewrites": [
    ]
  }
}

If you are still having issues then you also have to change your database file to

{
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null"
  }
}

Upvotes: 8

Related Questions