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

Migration fails with Foundry API 12 #166

Open
bneumann opened this issue Dec 14, 2024 · 0 comments
Open

Migration fails with Foundry API 12 #166

bneumann opened this issue Dec 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bneumann
Copy link

Environment Details

  • Foundry Core Version: 12.331
  • System & Version: Alien RPG 3.2.1
  • OS & Browser: Windows & Firefox
  • Hosting:
    Self Hosted

Describe the bug
Installation of the module and initial usage were fine. Until I restarted my Foundry to set some user rights. After that the module crashes with this error in the console:

Uncaught (in promise) TypeError: (intermediate value)().modules.get(...).data is undefined
[Detected 2 packages: gm-screen(3.0.1), lib-wrapper(1.13.2.0)]
    _gmScreenMigrate migration.js:15
    <anonymous> foundryvtt-gmScreen.js:81
    #call foundry.js:632
    callAll foundry.js:589
    setupGame foundry.js:9098
    _initializeGameView foundry.js:10432
    _initializeView foundry.js:10408
    initialize foundry.js:8995
    initialize#0 libWrapper-wrapper.js:188
    <anonymous> foundry.js:95974
    async* foundry.js:95954

To Reproduce

  1. Install module
  2. Do some editing, whatever
  3. Restart Foundry

Expected behavior
That the module launches

Additional Information
The API 12 documentation does not mention the field .data anymore. But it seems to have the version - which the migration code tries to get - in a top level field now: https://foundryvtt.com/api/classes/foundry.packages.BaseModule.html#defineSchema
So maybe it would suffice to change migration.ts line 27:

if (isNewerVersion(getGame().modules.get(MODULE_ID)?.data.version ?? '0', NEEDS_MIGRATION_VERSION)) return;

to

if (isNewerVersion(getGame().modules.get(MODULE_ID)?.version ?? '0', NEEDS_MIGRATION_VERSION)) return;
@bneumann bneumann added the bug Something isn't working label Dec 14, 2024
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

1 participant