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

Getting error on API Sandbox

SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at apiscript.js:9363:33 at Timeout._onTimeout (/home/node/d20-api-server/node_modules/underscore/underscore.js:825:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) Getting the above as error. If I restart Sandbox it goes away. Any help?
1607983237

Edited 1607983255
Jordan C.
Pro
API Scripter
Is there a script running that tries to perform actions without the "on('ready')" function? I can't tell from that which script is throwing the error.
1607983383
The Aaron
Roll20 Production Team
API Scripter
This happens when the value passed to JSON.parse() is the javascript special value undefined .  Can you link to or post the script you're running?
Hi both. Thanks for the reply. I opened the games now and they both seem fine since a restart yesterday. Could it be because of the updates that happened yesterday, caused some sort of master reset? Anyway here's the code. Mind you, I'm not a programer at all, I just copied and pasted a lot of stuff so I'm a little oblivious to it all. Thanks. "--- Initialized It's A Trap! v3.13.1, using theme '5E-Generic' ---" Restarting sandbox due to script changes... Previous shutdown complete, starting up... Spinning up new sandbox... "Starting webworker script..." "Loading 715 translation strings to worker..." "It's A Trap!: Registered TrapTheme - default." "-=> GroupCheck v1.12 <=-" "-=> GroupInitiative v0.9.35 <=-  [Mon Oct 12 2020 13:45:47 GMT+0000 (Coordinated Universal Time)]" "-=> ApplyDamage v1.1 <=-" "-=> TokenMod v0.8.61 <=-  [Tue Aug 11 2020 20:54:05 GMT+0000 (Coordinated Universal Time)]" "StatusInfo Ready! Command: !condition" "-=>HealthColors v1.6.1 [Updated: Aug 20 2020]<=-" "-=> TokenLock v0.2.8 <=-  [Fri May 22 2020 23:37:22 GMT+0000 (Coordinated Universal Time)]" "Concentration Ready! Command: !concentration" "Starting Fumbler v0.2.0" "Invalid input from globalconfig! Using n = 20" "Treehugger is up and running!" "It's A Trap!: Registered TrapTheme - 5E-Generic." "D&D 5E trap theme - auto-detected character sheet: roll20" "InspirationTracker Ready! Command: !insp" "-=> HazInspiration <=- V0.22" "TokenAction v0.3.1 is ready!  Designed for use with the D&D 5th Edition by Roll20 character sheet!" "-=> DoorKnocker v1.16 <=-  [Wed Jul 22 2020 18:09:50 GMT+0000 (Coordinated Universal Time)]" "[ModifyTokenImage:2020-12-15 07:26:12] v1.0.4 Starting Up..." "[ModifyTokenImage:2020-12-15 07:26:12] Event Handlers registered." "[ModifyTokenImage:2020-12-15 07:26:12] Started up and running properly." "CombatTracker Ready! Command: !ct" "*** Initialized Welcome Package v1.3.2 ***" "--- Initialized It's A Trap! v3.13.1, using theme '5E-Generic' ---"
1608037986
The Aaron
Roll20 Production Team
API Scripter
Well, I guess as long as it's working... If it happens again, post back. 
Hi Aaron. The API sandbox seems to keep crashing. Last week it was ok, but this week it's really bad. I only added Roll20AM to it, but I feel the It's a trap is also causing some sort of clash. Can you help?
Just tested someone activating a trap and it crashed. Here's the error message. Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Script Library, you might find help in the Community API Forum. For reference, the error message generated was:  TypeError: Cannot read property 'indexOf' of null TypeError: Cannot read property 'indexOf' of null at Object.d20.textchat.doChatInput (eval at <anonymous> (/home/node/d20-api-server/api.js:158:1), <anonymous>:332:18) at sendChat (/home/node/d20-api-server/api.js:1815:16) at outputConfig (apiscript.js:21465:16) at changeHandler (apiscript.js:21872:21) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:154:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1055:14) at updateLocalCache (/home/node/d20-api-server/api.js:1345:18) at /home/node/d20-api-server/api.js:1557:7 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560
1608732595
The Aaron
Roll20 Production Team
API Scripter
It looks like that's coming from Roll20 Audio Master.  I'm not sure what is causing it.
Hmmm, ok. I'll just delete it. Thanks mate.
1608820616
Victor B.
Pro
Sheet Author
API Scripter
Deleting it is your choice.  That error comes up when the jukebox is changed and Roll20AM isn't refreshed.  
And how does one refresh it?
1609089291
Victor B.
Pro
Sheet Author
API Scripter
Bring up roll20am config page !roll20AM --config.  Remove all tracks.  Import Tracks.  Roll20AM maintains a copy of the jukebox.  It tracks more information along with the information from jukebox.  When large changes are made to your playlists, you need to remove/import again.  If you're adding new tracks to an existing playlist all you need to do is import.  
Right, ok. So why does triggering a trap would make Roll20AM and the whole API sandbox crash?
1609175167
The Aaron
Roll20 Production Team
API Scripter
Probably when It's a Trap triggers a sound effect, it causes an event that Roll20 Audio master doesn't know how to respond to.
Hmmm... ok that would make sense. Thanks mate.