fix(): Transform map (#13655)

**What**
It seems that for some reason the weak map fail in some scenario, but after investigation, the usage of map would not have a bad impact as it will be released after the Distributed transaction if finished. Therefore, falling back to Map instead

FIXES https://github.com/medusajs/medusa/issues/13654

NOTE: Waiting for the user feedback as he is also using node 18. We also use the exact same pattern in all our core flows without issues 🤔
This commit is contained in:
Adrien de Peretti
2025-10-02 15:54:11 +00:00
committed by GitHub
parent ea3d0100a9
commit 8734866eb1
4 changed files with 30 additions and 17 deletions
@@ -170,7 +170,7 @@ export function transform(
} as WorkflowData & {
__id: string
__type: string
__temporary_storage_key: { key: string } | null
__temporary_storage_key: string | null
}
const returnFn = async function (
@@ -179,8 +179,7 @@ export function transform(
): Promise<any> {
if ("transaction" in transactionContext) {
const temporaryDataKey = `${transactionContext.transaction.modelId}_${transactionContext.transaction.transactionId}_${uniqId}`
ret.__temporary_storage_key ??= { key: temporaryDataKey }
ret.__temporary_storage_key ??= temporaryDataKey
if (
transactionContext.transaction.hasTemporaryData(