fix(translation): prevent duplicate locale error on server restart (#14345)

The translation module's defaults loader throws a warning on every server
restart after the first run because the upsert method uses `id` as the
unique key, but defaultLocales only contains `code` and `name`.

This causes the upsert to always attempt creation, which fails on the
unique `code` constraint with: "Locale with code: en-US, already exists."

Fix: Fetch existing locales first and map their IDs into defaultLocales
so upsert can properly identify existing records and update them.
This commit is contained in:
0xFl4g
2025-12-18 11:56:18 +01:00
committed by GitHub
parent 92d240d749
commit 0277062fec
2 changed files with 27 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/translation": patch
---
fix(translation): prevent duplicate locale error on server restart