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 me understand this API error

Hiya, new group taking on old campaign - I've created a copy of the last campaign and everything seemed to work perfect until I imported the maps and now the API hangs everytime. Can someone make sense of what this error message means? I rather not have to delete all the maps and start from scratch. ( It's a lot of maps ) For reference, the error message generated was: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at apiscript.js:14465:16 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:909:14) at updateLocalCache (/home/node/d20-api-server/api.js:1194:18) at /home/node/d20-api-server/api.js:1368:11 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Rd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)
Disable each API script and retry to see which is causing the error. 
Yea, It's probably what I have to do. But there are so daaaamn many. :P
1516921430
The Aaron
Pro
API Scripter
Disable All Scripts Bookmarklet: javascript:$('button.active.togglescript').click(); Enable All Scripts Bookmarklet: javascript:$('button.inactive.togglescript').click();
1516942941
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ooh, will that latter jumpstart a crashed API?
1516943259
GiGs
Pro
Sheet Author
API Scripter
*quietly adds yet another of Aaron's posts to my sourcebook of useful code for roll20.*
1516944418

Edited 1516944537
The Aaron
Pro
API Scripter
keithcurtis said: Ooh, will that latter jumpstart a crashed API? Only if at least one of the scripts is disabled.  What you really want would be something like: javascript:($('button.savescript')[0]||{click:()=>{}}).click(); That will work, provided you have at least one script installed. =D Actually, adjusted it to always work (well, not crash, anyway.  If you have no scripts, it will technically not restart them, but then, they aren't there at all, so restarting them wouldn't really do anything... =D)
I see it now a new book by The Aaron titled yes I got something for that.  You sir should sign write it up 
1516948681
The Aaron
Pro
API Scripter
=D
I'm amazed and pleased. Thanks Aaron. :)
1516981683
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron said: keithcurtis said: Ooh, will that latter jumpstart a crashed API? Only if at least one of the scripts is disabled.  What you really want would be something like: javascript:($('button.savescript')[0]||{click:()=>{}}).click(); That will work, provided you have at least one script installed. =D Actually, adjusted it to always work (well, not crash, anyway.  If you have no scripts, it will technically not restart them, but then, they aren't there at all, so restarting them wouldn't really do anything... =D) Ah, I understand. I probably won't be using these, then. I usually keep several disabled at any given time.
1516988860
The Aaron
Pro
API Scripter
To be clear, this will restart the API without changing the enabled/disabled state of any scripts: javascript:($('button.savescript')[0]||{click:()=>{}}).click();
1516992217
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Cool. Thanks.
The Aaron said: To be clear, this will restart the API without changing the enabled/disabled state of any scripts: javascript:($('button.savescript')[0]||{click:()=>{}}).click(); Anyway to make this work if the API tab isn't the active one?  That would be really useful.  (Preferably w/o making it switch tabs as well, though that would be acceptable, if necessary.)
1517030029
The Aaron
Pro
API Scripter
Three of Swords said: Anyway to make this work if the API tab isn't the active one?  That would be really useful.  (Preferably w/o making it switch tabs as well, though that would be acceptable, if necessary.) Yes, but it's far from trivial.  Would require a full blown extension for chrome or firefox to allow cross tab communication.
1517041145
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Or Applescript. :P (Well, Ok, it would still switch tabs...)
The Aaron said: Three of Swords said: Anyway to make this work if the API tab isn't the active one?  That would be really useful.  (Preferably w/o making it switch tabs as well, though that would be acceptable, if necessary.) Yes, but it's far from trivial.  Would require a full blown extension for chrome or firefox to allow cross tab communication. Alright. Don't waste your time doing that then. I can change tabs and click a button occasionally.  Or I could put more error handling into my scripts...