Can't remove values in Firebase realtime Database - firebase

I want to remove a node (~13mb) from my realtime database. I use cli with firebase database:remove '/node' but i am getting An unexpcted error. Debug file says:
[debug] [2020-09-30T10:17:16.845Z] TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined
at validateString (internal/validators.js:122:11)
at Url.parse (url.js:159:3)
at urlParse (url.js:154:13)
at Url.resolve (url.js:667:29)
at Object.urlResolve [as resolve] (url.js:663:40)
at Object.getDatabaseUrl (/usr/local/lib/node_modules/firebase-tools/lib/utils.js:62:26)
at Command.actionFn (/usr/local/lib/node_modules/firebase-tools/lib/commands/database-remove.js:33:32)
at Command.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/command.js:166:25)
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/node_modules/firebase-tools/lib/command.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
When i do a firebase database:get '/node' i am getting the correct values.
I already updated firebase-tools and did a new init.

I experienced a similar problem today and submitted this as an issue on the firebase-tools GitHub:
https://github.com/firebase/firebase-tools/issues/2667
I manually added a trivial key to the database and firebase database:remove had the same problem attempting to remove it.
Hopefully others there can reproduce and solve it.
(I would have commented this if I had the reps... But perhaps watching the issue get addressed over there is the true answer anyway 🤷)
Edit: Resolved with Changelog for database:remove command fix #2658 merged into master and released in version 8.12.0 -
Works great 👍

Related

FirebaseError: invalid stream token

After changing a cloud function I’m getting the following error for any write operation to my database: FirebaseError: invalid stream token. After changing the functions back and redeploying, the error still remains. I was unable to find any reference to this error in Firebase docs. Anyone know what this is about?
I "solved" this. For anyone else who runs into the error:
> rm package-lock.json
> rm -rf node-modules/
> npm install
Would still be nice to have a reference to this somewhere though.

Getting TypeError: Cannot convert object to primitive value when running firebase emulators:start

Just updated firebase-tools to 8.4.0 and now getting the following error when running firebase emulators:start:
⚠ TypeError: Cannot convert object to primitive value
at Proxy. (/Users/USER/.nvm/versions/node/v13.5.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:311:83)
Please let me know of any additional info needed!
The latest comment on the issue referenced by #RosárioPereiraFernandes says:
In general nobody should be using
initializeApp(functions.config().firebase) anymore. The plain
initializeApp() is preferred.
I can attest that calling initializeAdd() without passing any arguments allows the emulator to start properly.
It's a regression in 8.3.0 and 8.4.0. For now downgrade to 8.2.0
npm i -g firebase-tools#8.2.0

TypeError: module.exports.v1 is not a constructor, error thrown from google-cloud/firestore when using firebase-admin sdk

Recently I encountered the above error (TypeError: module.exports.v1 is not a constructor) when trying to run firebase-firestore related tests. Earlier I had no issue running the tests but after doing a npm install was getting the above error.
The source of the error is from google-cloud/firestore which is required by firebase-admin.
Tried several options but it doesn't seems to get resolved. I then tried with an older node-module and it worked as expected.
The problem was due to the test framework I've been using. Once I changed from jest to mocha the problem got solved.
When I updated firebase admin sdk from 8.4.0 to higher then I had same error in running jest test code.
I fixed it to add --env node option for jest.
jest --env node
I hit this error when I left out an await on an async function. That caused my code to continue running after the jest environment had been torn down.
There was a message that said ReferenceError: You are trying to import a file after the Jest environment has been torn down. which should have been a tip that I was running async code and not waiting for completion.
We needed to upgrade node from v8.11.3 to v8.16.2.

firebase serve: supervisorPort (5001) is already in use

I built this React App, that allows users to add todo item, and mark an item as completed/active. Todo items are stored in cloud firestore.
I want to enable full-text search on the app, and one way is to create a cloud function that writes index to Algolia whenever cloud firestore witnesses a create operation.
Inside my app root directory, I initialize cloud functions and then implement the onTodoAdded function. After done, I run firebase serve under functions directory and get the errors:
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i hosting: Serving hosting files from: build
✔ hosting: Local server: http://localhost:5000
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Server.setupListenHandle [as _listen2] (net.js:1335:14)
at listenInCluster (net.js:1383:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1509:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
error: supervisorPort (5001) is already in use
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
For a complete debug log, find here.
However, this command works fine: firebase serve --only functions.
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
Since it says supervisorPort(5001) is already in use, I lsof -i:5001 and finds no process. I also shut down my laptop and restart, gets the same error.
I find the similar issue here, however didn't find the solution.
I still don't know the reason, but adding --port=9000 solves the problem. For example, firebase serve --only functions --port=9000. Credits to restPort (5001) is already in use #142.
I was having this same error after updating to macOS Mojave 10.14.1 (was fine with 10.14). error: supervisorPort (5001) is already in use and it led me down this rabbit hole of additional updates and configuration that eventually got it to work.
1 Update Node Packages
I updated these items to these versions (latest as of this writing)
firebase-functions: 2.1.0
firebase: 5.5.8
I deleted by node_modules folder and reinstalled all the packages.
2 Firestore Emulator Setup Required
Next time I attempted to serve, firebase gave me this error:
Setup required, please run: firebase setup:emulators:firestore
Because of the weird permissions issues I initially had with mac, I actually have to run
node_modules/.bin/firebase setup:emulators:firestore
3 Then.... Fix Java Runtime Issues
On my next serve attempt, I was presented with firestore: No Java runtime present, requesting install. Mac presents a popup leading to a page where you can "download java for mac". This isn't what you actually need. You really need the Java SE Development Kit which enables command line interface.
Then... You may get these errors the next time you try to serve.
error: restPort (5002) is already in use
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1501:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
error: supervisorPort (5001) is already in use
But Firebase still ended up continuing to successfully serve somehow, despite these errors. And it still shows my app over http://localhost:5000.
Hope this helps!

Error on meteor project setup

I setup meteor environment
meteor create todoapp
cd todoapp
Then write meteor and press enter after then I run on localhost:3000 then I receive following error on terminal
Exception from sub meteor_autoupdate_clientVersions id fRm2pMK35Ji2uPut5
TypeError: Cannot read property 'OneOf' of undefined
I don't know what the actual reason of this issue any way I found a solution I uninstalled Meteor the reinstalled it after this the issue has been resolved.

Resources