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

Error: Firebase.update failed: First argument contains NaN in property 'current'

During today's session I realized that some of my APIs weren't working and when I checked afterwards I noticed I had this error message in my API console log: Error: Firebase.update failed: First argument contains NaN in property 'current' Error: Firebase.update failed: First argument contains NaN in property 'current' 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 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:864:27) at later (/home/node/d20-api-server/node_modules/underscore/underscore.js:892:31) at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:829:19) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) When I reset my API sandbox things seemed to work for a minute but then broke again. I think it has something to do with LazyExperience API because after attempting to add EXP to my session pull when a monster token dies, it doesn't and that's when I think I'm getting this error. Not sure what else I can do to debug?
1586830242
The Aaron
Roll20 Production Team
API Scripter
This happens when a script sets an attribute to something that is NaN (Not a Number), which is usually the result from a failed parseInt() or parseFloat() call.  LazyExperience doesn't seem to do anything with attributes, so I don't think it's the culprit.  What other scripts are you running?
Thanks for your fast response Aaron. Good to know what NaN means. My other scripts are: Critical Fumbler namegen DeathTracker LazyExperience Roll20 Audio Master 5th Edition OGL by Roll20 Companion Out of these I'd wager DeathTracker is the next culprit. Simply because I notice all my scripts failing as soon as I mark a token dead and try to mess with EXP
1586831231
The Aaron
Roll20 Production Team
API Scripter
I'm actually betting on the 5th Edition OGL by Roll20 Companion script.  There are a bunch of places it can end up with NaN due to bad inputs.  Long rest for a character that has something that's not a number for its current or max hp, for example.
Right on let me try disabling that one. Will report back.
1586831287
The Aaron
Roll20 Production Team
API Scripter
I looked at the other scripts (other than namegen, as I don't believe it does anything with attributes) and the only other one that does a .set() is DeathTracker, but it doesn't set any attributes.
Disabled OGL Companion script and reset sandbox. Launched game and played with dead token HP / XP. Stopped working and API console log says the same Firebase error.  Going to try and disable DeathTracker now.
Hmm still getting the error with DeathTracker disabled also.
1586832536
The Aaron
Roll20 Production Team
API Scripter
Hmm. Try disabling all of them and then reenable only one at a time?  If you haven't already, refresh your game session.  It's possible something in the there's something still hanging out there that's causing an issue... maybe?
I think I found it! One of my players manually entered in their experience attribute and set it to "52,000" and when my LazyExperience API tried to set the experience to her sheet it was spitting out the NaN because of the " , " I'm going to add back in the others and see if the error continues to not show up.
It works! Thanks for helping me reason through it, Aaron!
1586833290
The Aaron
Roll20 Production Team
API Scripter
Awesome work tracking that down!  That's a super obnoxious bug. I found where the problem is: let new_experience = getAttrByName(characterid, state[state_name].config.experience_attribute_name, 'current')*1 + experience*1; I always forget about getAttrByName().  I'll see about pushing a fix for that.