firebase-import CLI tool: permission_denied

248 views
Skip to first unread message

kyurim

unread,
Sep 21, 2016, 11:32:44 PM9/21/16
to Firebase Google Group
Hi Firebase Group!
I'm having issues with using the firebase-import CLI tool.
I'm uploading a small json file from local system to firebase.  I am getting a permission_denied error.  (See output below)
It's worth noting that I do not have any security measures setup on this test account.

Has anyone run into this issue?

TIA :)
-Kyurim


kyurims-MBP:migration kyurim$ firebase-import --database_url https://firebase-test-dev.firebaseio.com --path / --json firebase_feedback.json --merge
Each top-level child in firebase_feedback.json will be written under https://firebase-test-dev.firebaseio.com/.  If a child already exists, it will be overwritten.
Press <enter> to proceed, Ctrl-C to abort.


Reading /Users/kyurim/Desktop/{migration}/firebase_feedback.json... (may take a minute)
Preparing JSON for import... (may take a minute)
FIREBASE WARNING: set at /_migration failed: permission_denied
FIREBASE WARNING
: Exception was thrown by user callback. ReferenceError: i is not defined

    at onComplete (/usr/local/lib/node_modules/firebase-import/bin/firebase-import.js:211:55)
    at
/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:28:463
    at
/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:218:133
    at
Pb (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:49:165)
    at bi
(/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:218:23)
    at
/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:213:404
    at
/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:145:167
    at
Fg.h.ud (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:146:104)
    at tg
.ud (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:137:364)
    at
Zf.fg (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:135:280)
/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:49
(d="0"+d),c+=d;return c.toLowerCase()}var ed=/^-?\d{1,10}$/;function Zc(a){return ed.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function Pb(a){try{a()}catch(b){setTimeout(function(){L("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function fd(a,b,c){Object.defineProperty(a,b,{get:c})};function gd(a){var b={},c={},d={},e="";try{var f=a.split("."),b=Gb(Nc(f[0])||""),c=Gb(Nc(f[1])||""),e=f[2],d=c.d||{};delete c.d}catch(g){}return{Ig:b,Ke:c,data:d,xg:e}}function hd(a){a=gd(a);var b=a.Ke;return!!a.xg&&!!b&&"object"===typeof b&&b.hasOwnProperty("iat")}function id(a){a=gd(a).Ke;return"object"===typeof a&&!0===B(a,"admin")};function jd(a,b,c){this.type=kd;this.source=a;this.path=b;this.children=c}jd.prototype.Kc=function(a){if(this.path.e())return a=this.children.subtree(new M(a)),a.e()?null:a.value?new Xb(this.source,D,a.value):new jd(this.source,D,a);F(J(this.path)===a,"Can't get


ReferenceError: i is not defined
    at onComplete (/usr/local/lib/node_modules/firebase-import/bin/firebase-import.js:211:55)
    at /usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:28:463
    at /usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:218:133
    at Pb (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:49:165)
    at bi (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:218:23)
    at /usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:213:404
    at /usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:145:167
    at Fg.h.ud (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:146:104)
    at tg.ud (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:137:364)
    at Zf.fg (/usr/local/lib/node_modules/firebase-import/node_modules/firebase/database-node.js:135:280)





kyurim

unread,
Sep 22, 2016, 11:12:57 AM9/22/16
to Firebase Google Group
Here is more information on firebase-import CLI tool:

It does say that --service_account is not a required 

$ firebase-import
Usage: firebase-import

Options:
  --database_url     Firebase database URL (e.g. https://databaseName.firebaseio.com).   [required]
  --path             Database path (e.g. /products).                                     [required]
  --json             The JSON file to import.                                            [required]
  --merge            Write the top-level children without overwriting the whole parent.
  --force            Don't prompt before overwriting data.
  --service_account  Path to a JSON file with your service account credentials.

Kato Richardson

unread,
Sep 22, 2016, 11:14:26 AM9/22/16
to Firebase Google Group
Hi Kyurim,

That database doesn't seem to exist:  https://firebase-test-dev.firebaseio.com/.json

Can you ping me the correct db URL (off list is fine)

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/aa658d81-b96d-41eb-8564-29cb14cb0d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

kyurim

unread,
Sep 22, 2016, 1:16:39 PM9/22/16
to Firebase Google Group
Hi Kato.
Yes, I did changed the URL as I left my database open and unsecure for now.
I'd like to give you the URL to my database, but I'm having difficulties getting your email address from this Google Groups site.  
Can you email me at the following address so I can give you my Firebase URL?


On a separate question, I am also trying to use "--service_account" flag, but I can't seem to find much documentation on how to use this.  
Can you point me to doc on how to use this flag or update the README on https://github.com/firebase/firebase-import?

Many Thanks,
Kyurim
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/aa658d81-b96d-41eb-8564-29cb14cb0d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kato Richardson

unread,
Sep 22, 2016, 2:37:34 PM9/22/16
to Firebase Google Group
Hi again : )

Setting up a service account is covered here; that should give you enough context to get the json file you need. Let me know if you run into issues.

Regarding the permission denied error:  Your database isn't actually open for world read as you've suspected. Taking the database URl you sent and adding .json onto the end (e.g. https://<YOUR-FIREBASE-APP>.firebaseio.com/.json), I get the following:
{ "error" : "Permission denied" }
So it's definitely secured. The service account will hopefully help with that, too!

☼, Kato





To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jorge Israel Toledo Alvarado

unread,
Oct 16, 2017, 9:08:28 PM10/16/17
to Firebase Google Group
I was having the same problem, try to change the rules of your database to public, and then importing the data, afterwards, you can change the rules back to private.

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

Reply all
Reply to author
Forward
0 new messages