vtta-dndbeyond icon indicating copy to clipboard operation
vtta-dndbeyond copied to clipboard

"TypeError: Cannot read property 'componentId' of undefined": unexpected class features from Tasha's Cauldron?

Open DrDougPhD opened this issue 4 years ago • 7 comments

Replicated on FoundryVTT versions 0.6.5, 0.7.1, and 0.7.7. Tested with vtta-dndbeyond version 3.3.4


Steps to replicate:

  1. Create a blank character in FoundryVTT
  2. Open D&D Beyond Character Import prompt and import this character: https://www.dndbeyond.com/profile/Neal_for_Real/characters/39497980 (JSON here: https://gist.github.com/DrDougPhD/4fd19521e6de12d61b840435ada61019/a1b2f026128bc078fe104f23e970939da5ebc28f)
  3. Grab JSON and paste into appropriate text area
  4. Press "Start Import"

Expected result: Successful import followed by the import modal closing, revealing the FoundryVTT character sheet sync'ed with D&D Beyond.

Actual result: Import modal does not close, remains at "Always prepared spells received, adding them to your import"

Chrome Dev Console error message:

import.js:849 Uncaught (in promise) Error: TypeError: Cannot read property 'componentId' of undefined
    at CharacterImport.parseCharacterData (import.js:849)

Exception is thrown here, due to classOption being undefined: https://github.com/VTTAssets/vtta-dndbeyond/blob/master/src/parser/templateStrings.js#L83

classOption appears to be undefined because at this stage, ddb.character.options.race, ddb.character.options.class, and ddb.character.options.feat are all empty arrays being processed here: https://github.com/VTTAssets/vtta-dndbeyond/blob/master/src/parser/templateStrings.js#L80

But, that probably wouldn't have happened if the class could be looked up by the feature being processed here: https://github.com/VTTAssets/vtta-dndbeyond/blob/master/src/parser/templateStrings.js#L75

I speculate this is due to new class features being offered from Tasha's Cauldron. the feature.componentId that is being processed is 3021781, but that does not appear anywhere else in the JSON payload produced by the above character sheet.

DrDougPhD avatar Nov 20 '20 15:11 DrDougPhD

Some of these details might be relevant:

  • This character is a Druid adopting class features from Tasha's Cauldron of Everything
  • The offending feature being processed is the "Wild Companion" feature, which is detailed in Tasha's

Successful workaround was to remove the "Wild Companion" feature from the list of actions, see this commit on the gist: https://gist.github.com/DrDougPhD/4fd19521e6de12d61b840435ada61019/revisions#diff-ed12034d24bba8eadb8a11d0bf580b6045ee504ac0ba4c9177c76e38b0d83f01

DrDougPhD avatar Nov 20 '20 16:11 DrDougPhD

Hey,

i can confirm that. The componentID of the feature is not found in the lookup, so the classinfo object is undefined. As we are playing today, i just removed it from the json. I'm wondering why it is even looking this up, as this feature has it's own definition where i think is everything included. But i didn't manage to start digging into this yet. Just started using this awesome feature ;)

WhiteTomX avatar Nov 21 '20 14:11 WhiteTomX

Hi, we also have this problem with content from Tasha's

Can also report that for the Ranger the Optional Feature - "Primal Awareness" that gives extra spells does not work.

skellcoder avatar Nov 22 '20 21:11 skellcoder

@skellcoder check this issue out. I also ran into the "Primal Awareness" and found some temporary workarounds.

https://github.com/VTTAssets/vtta-dndbeyond/issues/305

DrDougPhD avatar Nov 23 '20 14:11 DrDougPhD

I just noticed, that the characters don't use tasha's at all. No one bought it yet. Maybe that's the problem?

WhiteTomX avatar Nov 23 '20 17:11 WhiteTomX

@WhiteTomX https://github.com/VTTAssets/vtta-dndbeyond/issues/305 deals with a Ranger that, while not employing any features from Tasha's, seems to be failing because of Tasha's.

DrDougPhD avatar Nov 24 '20 00:11 DrDougPhD

FYI My "DDB Importer" module available in Foundry has fixes for this bug. https://foundryvtt.com/packages/ddb-importer/

MrPrimate avatar Nov 24 '20 12:11 MrPrimate