Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Help] Firebase.update failed

May 23 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, I'm suddenly getting this error when using one of my scripts: 

Error: Firebase.update failed: First argument contains NaN in property 'current'
Error: Firebase.update failed: First argument contains NaN in property 'current'
    at Error (native)
    at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:186)
    at Ba (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207)
    at Aa (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462)
    at Ea (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403)
    at H.J.update (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318)
    at TrackedObj._doSave (/home/node/d20-api-server/api.js:566:27)
    at later [as _onTimeout] (/home/node/d20-api-server/node_modules/underscore/underscore.js:828:25)
    at Timer.listOnTimeout (timers.js:92:15)
I can't even seem to figure out where the error is being caused. I can put a log('this point reached') call anywhere in the code, and as long as it is the first log call reached, it is output to the console. Subsequent log calls are not output. If however I delete what used to be the first log call, the log call that was the second now outputs. The error seems to be referencing something in the roll20 base script maybe? or in firebase itself that I've somehow screwed up?

Anyways, anybody have any ideas?

-Scott
May 23 (8 years ago)
The Aaron
Pro
API Scripter
This problem shows up when you set something that is supposed to be a number to NaN, usually as the result of a bad parseInt() call.  

If it's actually stored NaN, you can write a script that walks through all your attribute objects and sets the current 0 if _.isNaN() on the value is true, and it should fix it.

You might also look through your active scripts for something that is setting an attribute on startup and possibly mis-parsing it.
May 23 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, weird, that code was working last week. Well, it's fixed now. Thanks Aaron.