KayelGee / token-attacher

MIT License
11 stars 18 forks source link

"attach_base is undefined" #62

Closed jmhnilbog closed 2 years ago

jmhnilbog commented 2 years ago

token attacher version: 4.2.1 foundry version: 0.8.9

I've made a token to represent a torch. It's a transparent token with a tile and a light attached.

When I drag out a copy of the token, the following notifications appear:

If I move to a different scene and attempt to drag out the token, I get the token, but the following error in the console. I also can't interact with the token at all until I run the Delete Missing Links macro.

Stack trace:

TypeError: attach_base is undefined
[Detected 2 packages: token-attacher, lib-wrapper]
    InstantAttach token-attacher.js:2646
    registerHooks token-attacher.js:235
    _call lib-wrapper.js line 1 > eval:4
    callAll foundry.js:153
    callback foundry.js:8777
    documents foundry.js:8747
    _handleCreateEmbeddedDocuments foundry.js:8747
    _createEmbeddedDocuments foundry.js:8640
    create backend.mjs:95
    createDocuments document.mjs:332
    createEmbeddedDocuments document.mjs:514
    undoHistory foundry.js:19953
    _onKeyZ foundry.js:947
    _handleKeys foundry.js:562
    _onKeyDown foundry.js:511
    KeyboardManager foundry.js:335
    initializeKeyboard foundry.js:4548
    setupGame foundry.js:4383
    _initializeGameView foundry.js:5213
    _initializeView foundry.js:5189
    initialize foundry.js:4286
    call_wrapped libWrapper-wrapper.js:467
    libWrapperInit libWrapper-api.js:696
    initialize#0 libWrapper-wrapper.js:162
    <anonymous> foundry.js:53613
    async* foundry.js:53595
jmhnilbog commented 2 years ago

It tooks like the issue might be related to the name I used for the initial token: "-token-". I'm repeating the process with a different name and it appears to be working without the issue above.

Edit: Spoke too soon. I do not get the "No token selected!" notification, but I still get this error in the console when trying to use the prefab in another scene.

Uncaught (in promise) TypeError: attach_base is undefined
[Detected 2 packages: token-attacher, lib-wrapper]
    regenerateLinks https://foundry.nilbog.com/modules/token-attacher/scripts/token-attacher.js:1798
    batchPostProcess https://foundry.nilbog.com/modules/token-attacher/scripts/token-attacher.js:1876
    registerHooks https://foundry.nilbog.com/modules/token-attacher/scripts/token-attacher.js:220
    _call https://foundry.nilbog.com/modules/lib-wrapper/lib-wrapper.js line 1 > eval:4
    callAll https://foundry.nilbog.com/scripts/foundry.js:153
    regenerateAttachedFromPrototype https://foundry.nilbog.com/modules/token-attacher/scripts/token-attacher.js:1729
KayelGee commented 2 years ago

Are you sure you're on 4.2.1? The line numbers in the error messages don't line up with the 4.2.1 release. They look like they are from 4.2.0. If it says 4.2.1 then can you uninstall and reinstall token attacher just to be sure?

Report back if the problem still persists after that.

jmhnilbog commented 2 years ago

You're right on the version -- I installed so recently I assumed I had whatever was currently showing at the head of main. I screwed up! Rebuilding my token after uninstalling 4.2.0 and installing 4.2.1 fixed things nicely.