INTERNAL ASSERT FAILED: removeWrite called with nonexistent writeId.

586 views
Skip to first unread message

Lucas

unread,
Sep 19, 2016, 9:36:55 AM9/19/16
to Firebase Google Group
Hello, I'm getting the below error, causing my Node.js app to fail. I have two questions. 

1. Why does this error occur?
2. What can I do to catch errors and stop them from halting the Node.js process? I'm already on Firebase-queue, which is "fault-tolerate", yet this still crashes my app. 
Thanks!

2016-09-19T13:16:01.883629+00:00 app[web.1]: Error: Firebase Database (3.4.0) INTERNAL ASSERT FAILED: removeWrite called with nonexistent writeId.
2016-09-19T13:16:01.883630+00:00 app[web.1]:     at Error (native)
2016-09-19T13:16:01.883631+00:00 app[web.1]:     at Ib (/app/node_modules/firebase/database-node.js:28:1228)
2016-09-19T13:16:01.883633+00:00 app[web.1]:     at bh.h.Cd (/app/node_modules/firebase/database-node.js:158:65)
2016-09-19T13:16:01.883632+00:00 app[web.1]:     at Hb (/app/node_modules/firebase/database-node.js:28:1199)
2016-09-19T13:16:01.883633+00:00 app[web.1]:     at vh (/app/node_modules/firebase/database-node.js:179:53)


Clément Aigreault

unread,
Sep 23, 2016, 8:01:17 AM9/23/16
to Firebase Google Group
I have exactly the same error when trying to remove a key on the firebase database. Don't know why... I will try to provide something to reproduce.

Michael Lehenbauer

unread,
Sep 23, 2016, 12:47:54 PM9/23/16
to Firebase Google Group
Hey Clément,

Sorry you're running into issues!  Unfortunately I haven't seen that error come up before.  Can you provide a way to reproduce it, or else a log output for a run that hits it? (You can enable logging with firebase.database.enableLogging(true))

Unfortunately this kind of error can't be caught (well, you could catch uncaught exceptions) since it indicates an internal failure within the SDK and continuing to execute could lead to corrupt data / events / etc.

Thanks,
-Michael

--
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/bcefee9c-c7b4-4bb9-8d20-9d37b27abf9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Clément Aigreault

unread,
Sep 24, 2016, 8:15:49 AM9/24/16
to Firebase Google Group
Thanks, I will give you the log that I get. I'm using firebase on server side with electron but the error happen when I'm executing my test using Jest.
For info I'm inserting some stuff on the database on the `beforeAll` function of jest and deleting those stuff on the `afterAll` function.
Maybe the problem come from me and my weird stack.

Here is the log

console.log src/lib/database.js:12
    Firebase is initialized

  console.log node_modules/firebase/database-node.js:42
    p:0: Browser went online.  

  console.warn node_modules/node-uuid/uuid.js:48
    [SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()

  console.log src/__tests__/queue.test.js:6
    1

  console.log node_modules/firebase/database-node.js:42
    0: set {"path":"/queue/specs","value":{"capture":{"start_state":"capture","in_progress_state":"capture_in_progress","finished_state":"diff","error_state":"capture_error","timeout":3600000,"retries":3},"diff":{"start_state":"diff","in_progress_state":"diff_in_progress","error_state":"diff_error","timeout":3600000,"retries":3}},"Jg":null}  

  console.log node_modules/firebase/database-node.js:42
    p:0: Buffering put: /queue/specs  

  console.log node_modules/firebase/database-node.js:42
    p:0: Making a connection attempt  

  console.log node_modules/firebase/database-node.js:42
    p:0: Making a connection attempt  

  console.log node_modules/firebase/database-node.js:42
    p:0: Auth token refreshed  

  console.log node_modules/firebase/database-node.js:42
    getToken() completed. Creating connection. 

  console.log node_modules/firebase/database-node.js:42
    c:0:0: Connection created  

  console.log node_modules/firebase/database-node.js:42
    c:0:0:0 Websocket connecting to wss://tokyo-charge-144221.firebaseio.com/.ws?v=5  

  console.log node_modules/firebase/database-node.js:42
    p:0: Auth token refreshed  

  console.log node_modules/firebase/database-node.js:42
    getToken() completed. Creating connection. 

  console.log node_modules/firebase/database-node.js:42
    c:0:1: Connection created  

  console.log node_modules/firebase/database-node.js:42
    c:0:1:0 Websocket connecting to wss://tokyo-charge-144221.firebaseio.com/.ws?v=5  

  console.log node_modules/firebase/database-node.js:42
    c:0:1:0 Websocket connected.  

  console.log node_modules/firebase/database-node.js:42
    c:0:1: Reset packet received.  New host: s-usc1c-nss-105.firebaseio.com  

  console.log node_modules/firebase/database-node.js:42
    c:0:1: Shutting down all connections  

  console.log node_modules/firebase/database-node.js:42
    c:0:1:0 WebSocket is being closed  

  console.log node_modules/firebase/database-node.js:42
    c:0:1:0 Websocket connection was disconnected.  

  console.log node_modules/firebase/database-node.js:42
    c:0:0:0 Websocket connected.  

  console.log node_modules/firebase/database-node.js:42
    c:0:0: Reset packet received.  New host: s-usc1c-nss-105.firebaseio.com  

  console.log node_modules/firebase/database-node.js:42
    c:0:0: Shutting down all connections  

  console.log node_modules/firebase/database-node.js:42
    c:0:0:0 WebSocket is being closed  

  console.log node_modules/firebase/database-node.js:42
    c:0:0:0 Websocket connection was disconnected.  

  console.log node_modules/firebase/database-node.js:42
    c:0:1:1 Websocket connecting to wss://s-usc1c-nss-105.firebaseio.com/.ws?v=5&ns=tokyo-charge-144221  

  console.log node_modules/firebase/database-node.js:42
    c:0:0:1 Websocket connecting to wss://s-usc1c-nss-105.firebaseio.com/.ws?v=5&ns=tokyo-charge-144221  

  console.log node_modules/firebase/database-node.js:42
    c:0:1:1 Websocket connected.  

  console.log node_modules/firebase/database-node.js:42
    c:0:1: Realtime connection established.  

  console.log node_modules/firebase/database-node.js:42
    p:0: connection ready  

  console.log node_modules/firebase/database-node.js:42
    p:0: reportStats {"c":{"sdk.js.3-4-0":1}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: {"r":1,"a":"s","b":{"c":{"sdk.js.3-4-0":1}}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: {"r":2,"a":"gauth","b":{"cred":"ya29.CjBnA2STq0uFYZQo64xVzfJ2qW6r7JjFl0t2q_dyvbr3mK6uv-1euLxex0K1iBLjXAM"}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: {"r":3,"a":"p","b":{"p":"/queue/specs","d":{"capture":{"error_state":"capture_error","finished_state":"diff","in_progress_state":"capture_in_progress","retries":3,"start_state":"capture","timeout":3600000},"diff":{"error_state":"diff_error","in_progress_state":"diff_in_progress","retries":3,"start_state":"diff","timeout":3600000}}}}  

  console.log node_modules/firebase/database-node.js:42
    c:0:0:1 Websocket connected.  

  console.log node_modules/firebase/database-node.js:42
    c:0:0: Realtime connection established.  

  console.log node_modules/firebase/database-node.js:42
    p:0: connection ready  

  console.log node_modules/firebase/database-node.js:42
    p:0: {"r":4,"a":"gauth","b":{"cred":"ya29.CjBnA2STq0uFYZQo64xVzfJ2qW6r7JjFl0t2q_dyvbr3mK6uv-1euLxex0K1iBLjXAM"}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: {"r":5,"a":"p","b":{"p":"/queue/specs","d":{"capture":{"error_state":"capture_error","finished_state":"diff","in_progress_state":"capture_in_progress","retries":3,"start_state":"capture","timeout":3600000},"diff":{"error_state":"diff_error","in_progress_state":"diff_in_progress","retries":3,"start_state":"diff","timeout":3600000}}}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: from server: {"r":1,"b":{"s":"ok","d":""}}  

  console.log node_modules/firebase/database-node.js:42
    c:0:1: Primary connection is healthy.  

  console.log node_modules/firebase/database-node.js:42
    p:0: from server: {"r":2,"b":{"s":"ok","d":{"auth":null,"expires":1474656237}}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: from server: {"r":3,"b":{"s":"ok","d":""}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: p response {"s":"ok","d":""}  

  console.log src/__tests__/queue.test.js:8
    2

  console.log src/__tests__/queue.test.js:19
    4

  console.log node_modules/firebase/database-node.js:42
    0: set {"path":"/queue","value":null,"Jg":null}  

  console.log node_modules/firebase/database-node.js:42
    p:0: {"r":6,"a":"p","b":{"p":"/queue","d":null}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: from server: {"r":4,"b":{"s":"ok","d":{"auth":null,"expires":1474656237}}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: from server: {"r":5,"b":{"s":"ok","d":""}}  

  console.log node_modules/firebase/database-node.js:42
    p:0: p response {"s":"ok","d":""}  


/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:28
function A(a,b,c,d){if((!d||p(c))&&!t(c))throw Error(xb(a,b,d)+"must be a valid function.");}function yb(a,b,c){if(p(c)&&(!ga(c)||null===c))throw Error(xb(a,b,!0)+"must be a valid context object.");};var zb=n.Promise||cb;cb.prototype["catch"]=cb.prototype.Ag;function Ab(){var a=this;this.reject=this.resolve=null;this.sa=new zb(function(b,c){a.resolve=b;a.reject=c})}function Bb(a,b){return function(c,d){c?a.reject(c):a.resolve(d);t(b)&&(Cb(a.sa),1===b.length?b(c):b(c,d))}}function Cb(a){a.then(void 0,aa)};function Db(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function B(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]}function Eb(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])};function Fb(a){var b=[];Eb(a,function(a,d){da(d)?Fa(d,function(d){b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))}):b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))});return b.length?"&"+b.j
Error: Firebase Database (3.4.0) INTERNAL ASSERT FAILED: removeWrite called with nonexistent writeId.
    at Error (native)
    at Ib (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:28:1228)
    at Hb (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:28:1199)
    at bh.Object.<anonymous>.h.Cd (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:158:65)
    at vh (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:179:53)
    at /home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:213:378
    at /home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:145:167
    at Fg.Object.<anonymous>.h.ud (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:146:104)
    at tg.Object.<anonymous>.tg.ud (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:137:364)
    at Zf.fg (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:135:280)
    at bg (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:123:109)
    at Client.Ka.onmessage (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/database-node.js:121:467)
    at Client.dispatchEvent (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js:22:30)
    at Client._receiveMessage (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/lib/faye/websocket/api.js:134:10)
    at Client.<anonymous> (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/lib/faye/websocket/api.js:34:49)
    at emitOne (events.js:101:20)
    at Client.emit (events.js:188:7)
    at Client.<anonymous> (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:451:14)
    at pipe (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:37:40)
    at Pipeline.Object.<anonymous>.Pipeline._loop (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:44:3)
    at Pipeline.Object.<anonymous>.Pipeline.processIncomingMessage (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/pipeline/index.js:13:8)
    at Extensions.processIncomingMessage (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/websocket_extensions.js:133:20)
    at Client._emitMessage (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:442:22)
    at Client._emitFrame (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:405:19)
    at Client.parse (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:141:18)
    at Client.parse (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/client.js:62:58)
    at IO.Object.<anonymous>.IO.write (/home/uhsac/Code/uimon/services/capture/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/streams.js:80:16)
    at TLSSocket.ondata (_stream_readable.js:555:20)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at TLSSocket.Readable.push (_stream_readable.js:134:10)
    at TLSWrap.onread (net.js:543:20)
npm ERR! Test failed.  See above for more details.



Le vendredi 23 septembre 2016 18:47:54 UTC+2, Michael Lehenbauer a écrit :
Hey Clément,

Sorry you're running into issues!  Unfortunately I haven't seen that error come up before.  Can you provide a way to reproduce it, or else a log output for a run that hits it? (You can enable logging with firebase.database.enableLogging(true))

Unfortunately this kind of error can't be caught (well, you could catch uncaught exceptions) since it indicates an internal failure within the SDK and continuing to execute could lead to corrupt data / events / etc.

Thanks,
-Michael
On Fri, Sep 23, 2016 at 12:43 AM, Clément Aigreault <aigre...@gmail.com> wrote:
I have exactly the same error when trying to remove a key on the firebase database. Don't know why... I will try to provide something to reproduce.

Le lundi 19 septembre 2016 15:36:55 UTC+2, Lucas a écrit :
Hello, I'm getting the below error, causing my Node.js app to fail. I have two questions. 

1. Why does this error occur?
2. What can I do to catch errors and stop them from halting the Node.js process? I'm already on Firebase-queue, which is "fault-tolerate", yet this still crashes my app. 
Thanks!

2016-09-19T13:16:01.883629+00:00 app[web.1]: Error: Firebase Database (3.4.0) INTERNAL ASSERT FAILED: removeWrite called with nonexistent writeId.
2016-09-19T13:16:01.883630+00:00 app[web.1]:     at Error (native)
2016-09-19T13:16:01.883631+00:00 app[web.1]:     at Ib (/app/node_modules/firebase/database-node.js:28:1228)
2016-09-19T13:16:01.883633+00:00 app[web.1]:     at bh.h.Cd (/app/node_modules/firebase/database-node.js:158:65)
2016-09-19T13:16:01.883632+00:00 app[web.1]:     at Hb (/app/node_modules/firebase/database-node.js:28:1199)
2016-09-19T13:16:01.883633+00:00 app[web.1]:     at vh (/app/node_modules/firebase/database-node.js:179:53)


--
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-tal...@googlegroups.com.

Michael Lehenbauer

unread,
Sep 26, 2016, 4:26:59 PM9/26/16
to Firebase Google Group
Thanks Clément,

I think there may be something funky happening related to a race condition related to authentication.  Can you share how you're initializing the firebase SDK (without sharing your actual service account credentials)?

Thanks,
-Michael

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.

Clément Aigreault

unread,
Sep 27, 2016, 10:58:41 AM9/27/16
to Firebase Google Group
Hello,

Here is the code that I use to initialize de firebase app.


const firebase = require('firebase')

const config = require('../../config')

firebase.initializeApp({
 databaseURL: config.databaseUrl,
 serviceAccount: config.credentials
})

console.log('Firebase is initialized')

module.exports = firebase.database()

I'm on nodejs so I'm using a service account file provided by google to authenticate.

Thanks for your time.

Michael Lehenbauer

unread,
Sep 28, 2016, 2:19:20 PM9/28/16
to Firebase Google Group
Thanks.  That part looks reasonable...

From the log it kinda' looks like there are maybe two copies of firebase loaded and executing at the same time or something (and conflicting with each other).  Could that be possible somehow?

Unfortunately the best way to continue diagnosing this is probably if you can provide an mcve demonstrating the issue (you can leave your service account out).  If you can come up with that and send it to me (mic...@firebase.com), I can probably dig into it.

Thanks!
-Michael

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.

Clément Aigreault

unread,
Sep 28, 2016, 6:31:35 PM9/28/16
to Firebase Google Group
Oh maybe the 2 copies of firebase is possible I was creating 2 instances (one for database and an other for storage). I will try again soon if this don't fix the problem I will try to do a mcve and send it to you.

Thanks for your time
Reply all
Reply to author
Forward
0 new messages