dnd5e
dnd5e copied to clipboard
References to an Embedded Document when using fromUuidSync causes script crash
Title
Foundry: 12.331 dnd5e: 3.3.1 midiQOL: 11.6.14.1
When attempting to utilize the "Add attack/damage buttons to item inventory list" option with NPC sheets specifically, the roll hook crashes:
Chat message WyM0ZBMYWbhPjwQn failed to render: Error: fromUuidSync was invoked on UUID '[any uuid]' which references an Embedded Document and cannot be retrieved synchronously.)
I fixed this by making _enrichChatCard async, awaiting it, and changing the relevant "Enriched roll flavor" section from
const item = fromUuidSync(roll?.itemUuid);
to
const item = await fromUuid(roll?.itemUuid);
This is a related issue to https://github.com/foundryvtt/dnd5e/issues/3675; this may be an issue elsewhere.