Reputation: 136
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
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
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
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
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
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