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] I keep getting the "TypeError: Cannot read property 'id' of undefined" Error

1611174890

Edited 1611174922
So I have been getting this error for a couple of games now and it completely crashes the API Sandbox. I saw another Post that said it was the Combat Tracker Script so I removed that and now use CombatMaster but it still happened. Can anyone help me here? Error : TypeError: Cannot read property 'id' of undefined TypeError: Cannot read property 'id' of undefined at showHelp (apiscript.js:51650:82) at commandHandler (apiscript.js:48023:7) at apiscript.js:47750:25 at Function.each (/home/node/d20-api-server/node_modules/underscore/underscore.js:1310:9) at inputHandler (apiscript.js:47745:23) 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 /home/node/d20-api-server/api.js:1662:12 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) And here are my Scripts:
1611175276
Andreas J.
Forum Champion
Sheet Author
Translator
I suggest you try to narrow down which is the cause, by turning off one at a time and checking if the error continues.
1611175967
The Aaron
Roll20 Production Team
API Scripter
This is the line causing the issue in CombatMaster: makeAndSendMenu(`&lt;a href="<a href="http://journal.roll20.net/handout/${handout[0].id}&quot;&gt;View" rel="nofollow">http://journal.roll20.net/handout/${handout[0].id}"&gt;View</a> Help&lt;/a&gt;`,title,'gm') The issue is that findHandout() is failing to find what it expects, and returns an empty array: findHandout = function (title) { let handout = findObjs({_type:'handout', name:title}) return handout }, The fix would be to either return an empty object that behaves like a roll20 handout, or create a handout by that name to return, or handle missing handouts explicitly.
Thank you! I will try to create a handout with the name "title" then and see if that works.
1611184840
The Aaron
Roll20 Production Team
API Scripter
title is a variable, it contains the name of one of the help handouts created by CombatMaster.&nbsp; I sent a message to Vic about this, maybe he can patch it to recreate the handout if it's missing. Did you delete some handouts created by the script?&nbsp; That would likely cause this to happen.
The Aaron said: title is a variable, it contains the name of one of the help handouts created by CombatMaster.&nbsp; I sent a message to Vic about this, maybe he can patch it to recreate the handout if it's missing. Did you delete some handouts created by the script?&nbsp; That would likely cause this to happen. No I freshly installed it, perhaps it wasn't done setting up when I ran one of the commands, I will test to see if it created the Handout in the meantime, maybe the error is gone now.
1611228120

Edited 1611234164
i had the same thing and it's definitely a timing issue as it takes some time for CM to create all handouts. Once CM has created the handouts it won't happen again.The creation - if needed - only starts after a second after API startup and each of 16 handouts requires two calls with measurable duration. It definitely possible to request help too early - and when you do that the API sandbox crashes and you can end up with a few empty handouts.&nbsp;
Martijn S. said: i had the same thing and it's definitely a timing issue as it takes some time for CM to create all handouts. Once CM has created the handouts it won't happen again.The creation - if needed - only starts after a second after API startup and each of 16 handouts requires two calls with measurable duration. It definitely possible to request help too early - and when you do that the API sandbox crashes and you can end up with a few empty handouts.&nbsp; Ahh yeah that must've been it since I've been testing it and the error hasn't come up again thank you.