foundryvtt / world-anvil

A module to integrate World Anvil with Foundry Virtual Tabletop.
MIT License
12 stars 7 forks source link

Unable to connect to a specific world #64

Closed kayhos closed 3 months ago

kayhos commented 1 year ago

Hello!

The module is throwing a CORS error on a specific world from World Anvil where it can't import my main world but any other world I create can be imported without issue.

Details

Tests done

The error in the console that I'm encountering everytime I try to load the 1st World Anvil World:

image

It's working fine for any world besides my main one where i've spent a lot of time, I don't think I have the courage to transfer my 500 articles into a new world.

kayhos commented 1 year ago

Another detail, I regenerated my API key in the World Anvil user API tokens.

kayhos commented 1 year ago

For additionnal information, the tools developped by SoulLink seem to work fine to access all my worlds. They are available here: https://toolbox.soullink.docker.worldanvil.com/home

This leads me to think there is a bug in the World Anvil Foundry VTT module implementation of the World Anvil API.

GorkamWorka commented 1 year ago

Worldanvil API dev here Can you give us the world id so we can test ?

that part

don't worry it's nothing secret

kayhos commented 1 year ago

Awesome! no problem, here it is: https:// www.worldanvil.com /world/ 4327fa0c-4b8b-4799-87cb-b881dc439ae2 /summary

kayhos commented 1 year ago

Just a quick follow up to see if anyone knows what's up ? @GorkamWorka ?

kayhos commented 1 year ago

If I wait for a while, the World Anvil windows eventually appears with no articles listed. See the below image:

image

Here is a textual log of what happens in the console when I click on the WA icon in the Journal pane and then click on Refresh All in the World Anvil window:

Access to fetch at 'https://www.worldanvil.com/api/aragorn/world/4327fa0c-4b8b-4799-87cb-b881dc439ae2/categories?limit=50&offset=0&x-application-key=SANITIZED&x-auth-token=SANITIZED' from origin 'https://kayhos.stifled.ca' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
www.worldanvil.com/api/aragorn/world/4327fa0c-4b8b-4799-87cb-b881dc439ae2/categories?limit=50&offset=0&x-application-key=SANITIZED&x-auth-token=SANITIZED:1          Failed to load resource: net::ERR_FAILED
foundry.js:747 TypeError: Failed to fetch
[Detected 1 package: world-anvil]
    at WorldAnvil._fetch (api.js:79:28)
    at WorldAnvil._fetchMany (api.js:104:32)
    at WorldAnvil.getCategories (api.js:163:17)
    at _getCategories (framework.js:583:31)
    at getCategories (framework.js:522:28)
    at WorldAnvilBrowser.getContentTree (journal.js:93:38)
    at WorldAnvilBrowser.getData (journal.js:75:29)
    at async WorldAnvilBrowser._render (foundry.js:5108:18)
onError @ foundry.js:747
foundry.js:59187 You have lost connection to the server, attempting to re-establish.
fetch @ foundry.js:59187
game:1 Access to fetch at 'https://www.worldanvil.com/api/aragorn/world/4327fa0c-4b8b-4799-87cb-b881dc439ae2/categories?limit=50&offset=0&x-application-key=SANITIZED&x-auth-token=SANITIZED' from origin 'https://kayhos.stifled.ca' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
api.js:79          GET https://www.worldanvil.com/api/aragorn/world/4327fa0c-4b8b-4799-87cb-b881dc439ae2/categories?limit=50&offset=0&x-application-key=SANITIZED&x-auth-token=SANITIZED net::ERR_FAILED 500
_fetch @ api.js:79
_fetchMany @ api.js:104
getCategories @ api.js:163
_getCategories @ framework.js:583
getCategories @ framework.js:522
_refreshAll @ journal.js:250
_onClickControlButton @ journal.js:195
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2
api.js:79                  Uncaught (in promise) TypeError: Failed to fetch
[Detected 1 package: world-anvil]
    at WorldAnvil._fetch (api.js:79:28)
    at WorldAnvil._fetchMany (api.js:104:32)
    at WorldAnvil.getCategories (api.js:163:17)
    at _getCategories (framework.js:583:31)
    at getCategories (framework.js:522:28)
    at WorldAnvilBrowser._refreshAll (journal.js:250:11)
    at WorldAnvilBrowser._onClickControlButton (journal.js:195:21)
    at HTMLButtonElement.dispatch (jquery.min.js:2:43064)
    at y.handle (jquery.min.js:2:41048)
thor547 commented 1 year ago

Same issue here. Only 1 world, my main world. Get the world splash page and no articles. Here's the details: Access to fetch at 'https://www.worldanvil.com/api/aragorn/world/#### from origin 'http://localhost:30000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. www.worldanvil.com/api/aragorn/world/### Failed to load resource: net::ERR_FAILED api.js:79 Uncaught (in promise) TypeError: Failed to fetch at WorldAnvil._fetch (api.js:79:28) at WorldAnvil._fetchMany (api.js:104:32) at async _getCategories (framework.js:583:19) at async getCategories (framework.js:522:22) at async WorldAnvilBrowser._refreshAll (journal.js:250:5)

GorkamWorka commented 1 year ago

I am currently unable to reproduce with any of my world. So i don't have that much info to contribute

kayhos commented 1 year ago

So do you have any guidance ? What would be the next steps ?

Do I need a new World and move over my 500 pages of lore ? Any pointers would greatly be appreciated.

kayhos commented 1 year ago

This issue has also been reported to the WorldAnvil Bug Tracker

Hamilcarbarcas commented 7 months ago

I recently started having this issue on a world that used to function properly. I don't suppose there was ever any update or fix on this issue?

kayhos commented 3 months ago

No Idea what happened, but it finally started working in my world. Thanks to whoever fixed it.