Firebase-tools: Specify which file has JSON parsing error

Created on 21 Aug 2016  Â·  8Comments  Â·  Source: firebase/firebase-tools

When I use the firebase deploy command I get this error:

Error: There was an error loading firebase.json:

Trailing comma in object at 11:9
}
^

My firebase.json file looks like this:

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

The json file doesn't even have line 11 !

Most helpful comment

Could there be a trailing comma in your rules file?

On Sat, Aug 20, 2016, 3:21 PM abdoosk [email protected] wrote:

When I use the firebase deploy command I get this error:

Error: There was an error loading firebase.json:

Trailing comma in object at 11:9
}
^

My firebase.json file looks like this:

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

The json file doesn't even have line 11 !

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/209, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAAD_kijDz_jd2CFiq1OmWdd9R39dSkyks5qh33igaJpZM4JpLXN
.

All 8 comments

Could there be a trailing comma in your rules file?

On Sat, Aug 20, 2016, 3:21 PM abdoosk [email protected] wrote:

When I use the firebase deploy command I get this error:

Error: There was an error loading firebase.json:

Trailing comma in object at 11:9
}
^

My firebase.json file looks like this:

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

The json file doesn't even have line 11 !

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/209, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAAD_kijDz_jd2CFiq1OmWdd9R39dSkyks5qh33igaJpZM4JpLXN
.

Yes, there was. Removed the comma and got no error :)
I never thought about checking the rules file.

Thank you Michael ♥

same problem here, using the "firebase serve" command.

public > firebase serve

Error: There was an error loading firebase.json:

Trailing comma in object at 6:3
  }
  ^

The problem is that it doesn't tell which firebase.json it is using, and there is no such files in the directory whence the command was fired:

public > ls
404.html         bower_components index.html       manifest.json    note-app.html    sw-import.js

(following this tutorial, step 6: https://codelabs.developers.google.com/codelabs/polymer-firebase-pwa/index.html?index=..%2F..%2Findex#5)

@lingtalfi the Firebase CLI looks up the directory path recursively until it finds a firebase.json. It looks like you're listing out your public directory. I'd recommend you go up a level and check firebase.json and database.rules.json (or another rules file) for issues.

Oh thanks, makes sense. So I went a level up, and now I have this error message (it's not the first time I already had problem with the "firebase serve" command some time ago):

pwapp-firebase > ls
database.rules.json firebase.json       public


pwapp-firebase > firebase serve

Error: There was an error loading firebase.json:

Trailing comma in object at 6:3
  }
  ^

But I see no trailling comma in my firebase.json file:

(firebase.json)

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

Weird.

As I mentioned, also look at database.rules.json as the Firebase CLI
parses it when initializing to make sure it's valid.

On Mon, Aug 22, 2016 at 10:33 AM LingTalfi [email protected] wrote:

Oh thanks, makes sense. So I went a level up, and now I have this error
message (it's not the first time I already had problem with the "firebase
serve" command some time ago):

pwapp-firebase > firebase serve

Error: There was an error loading firebase.json:

Trailing comma in object at 6:3
}
^

But I see no trailling comma in my firebase.json file:

(firebase.json)

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

Weird.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/209#issuecomment-241488639,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAD_qIkJShwkjo08eMhPZYxQE012mLQks5qid18gaJpZM4JpLXN
.

Oh I read too fast. Right, there was a trailling comma in "database.rules.json"; removed it and now it works just fine. Thank you. The poster should close this issue then.

I'm going to leave this open with the changed title "Specify which file has JSON parsing error" -- the CLI ought to direct you to the place in which the error actually occurred.

Was this page helpful?
0 / 5 - 0 ratings