Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded YTT to v11 and getting Cannot read properties of undefined (reading '0') #406

Open
ashcroftcloud opened this issue Oct 8, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@ashcroftcloud
Copy link

Describe the bug
Just updated to latest version of VTT. Disabled all macros and uninstalled any reporting errors. enabled DndBeyond Importer and attempted to import character, got error an import failed.

To Reproduce
Steps to reproduce the behavior:

  1. Opened existing character (also tried with new)
  2. Clicked on dndbeyond button
  3. start import
  4. Cannot read properties of undefined (reading '0')

Expected behavior
Character should import.

Environment:

  • Browser [chrome]
  • Foundry Version [version 11 stable, build 313]
  • 5e System Version [2.3.1]
  • Module Version [e.g 3.4.75]
  • Does this behaviour occur with other modules disabled: happens with and without other modules

Additional context
Add any other context about the problem here.

  • A Character URL, if the problem is a character import. https://www.dndbeyond.com/characters/101238717
  • Details of any errors in the browser console (press F12).
    foundry.js:68241 Cannot read properties of undefined (reading '0')
    fetch @ foundry.js:68241
    logger.js:81 DDB Importer | ERR > Error importing character: Object
    log @ logger.js:81
    logger.js:83 DDB Importer | ERR > TypeError: Cannot read properties of undefined (reading '0')
    at Tokenizer.stateBeforeEntity (/home/FoundryAdmin/foundryvtt/resources/app/node_modules/htmlparser2/lib/Tokenizer.js:584:47)
    at Tokenizer.parse (/home/FoundryAdmin/foundryvtt/resources/app/node_modules/htmlparser2/lib/Tokenizer.js:848:26)
    at Tokenizer.write (/home/FoundryAdmin/foundryvtt/resources/app/node_modules/htmlparser2/lib/Tokenizer.js:159:14)
    at Parser.write (/home/FoundryAdmin/foundryvtt/resources/app/node_modules/htmlparser2/lib/Parser.js:459:28)
    at sanitizeHtml (/home/FoundryAdmin/foundryvtt/resources/app/node_modules/sanitize-html/index.js:588:10)
    at cleanHTML (file:///home/FoundryAdmin/foundryvtt/resources/app/dist/database/validators.mjs:1:233)
    at HTMLField.sanitizeHTMLField [as sanitize] (file:///home/FoundryAdmin/foundryvtt/resources/app/dist/database/sanitization.mjs:1:1235)
    at Item._sanitizeFields (file:///home/FoundryAdmin/foundryvtt/resources/app/dist/database/backend/server-document.mjs:1:7729)
    at Item._sanitizeFields (file:///home/FoundryAdmin/foundryvtt/resources/app/dist/database/backend/server-document.mjs:1:7956)
    at Item._sanitizeFields (file:///home/FoundryAdmin/foundryvtt/resources/app/dist/database/backend/server-document.mjs:1:7956)
@ashcroftcloud ashcroftcloud added the bug Something isn't working label Oct 8, 2023
@MrPrimate
Copy link
Owner

This is coming from Foundry. It is likely that you are using an incorrect version of node, or updated the latest version without a proper new install of the code.

@ashcroftcloud
Copy link
Author

ashcroftcloud commented Oct 8, 2023 via email

@combsjy
Copy link

combsjy commented Nov 26, 2023

Just another datapoint. I ran into this same error. I am running from a docker container using the image node:16-alpine. I updated from v10 to v11 and then ran into this error. I build my docker image with the foundry application as a volume mount. I was able to blow away the contents of the application volume and recreate it from a fresh download and I no longer see the issue.

@jhutchings1
Copy link

I've run into this same issue today. I clean installed my server, and made sure I am using Node 18. @MrPrimate do you have any other suggestions on how to debug this one?

@MrPrimate
Copy link
Owner

I've run into this same issue today. I clean installed my server, and made sure I am using Node 18. @MrPrimate do you have any other suggestions on how to debug this one?

Make sure that your not using the app files from a previous install, you'll need to delete and then extract them a new.

Another gotcha is to make sure the node your app is using is definitely v18 and not a system default

@jhutchings1
Copy link

That worked. Thanks! I had previously copied over the old directory, but moving to an entirely clean directory fixed it. ✨

@sunian
Copy link

sunian commented May 16, 2024

@jhutchings1 I am also encountering this exact issue after upgrading to v11. What exactly were the app files you copied over? And where did you put the clean directory? Can you provide some more details on what your fix was? Thank you!

@jhutchings1
Copy link

@sunian delete everything in your current app directory, and then unzip a fresh download of Foundry to that directory.

@tmaestrelli
Copy link

@jhutchings1 I'm facing the same problem as the others, but I'm using linux to have the application in cloud. I did a clean install of v11 but used the old world in the new version.
By my experience with a similar problem I had with the world.json port, Foundry currently is not accepting the "&" caracter anywhere (you can't even put it on the chat), and worlds will not load if this character is in the world description. It is possible that other special characters that I'm not aware may also trigger the reading '0' error.
I'm using last version of node since I just run a upgrade and update on apt.
So, the direction is to go back to Node 18?
Thank you

@MrPrimate
Copy link
Owner

MrPrimate commented May 24, 2024

@tmaestrelli I believe it should work with newer versions of node, but it definitely works with 18. Remember as well, that if your calling foundry as a service or similar that it is also using that version of node and not a system default.

Mostly though, this tends to be because the foundry app folder has been copied over an existing one, or the update downloaded inside foundry when a new install was required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants