You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
REST where on a localized field 500s when localization.fallback: false and no ?locale= is sent (req.locale is null, validateSearchParams reads .length) #18180
So with fallback: false and no locale in the request, req.locale stays null. getLocalizedPaths then builds the path slug.null, and validateSearchParams does req.locale.length on null.
Unaffected: ?locale=de, ?locale=all, and where on non-localized fields. Still present in 3.89.0 (both files unchanged vs 3.88.0).
Same root cause hit here on 3.88.0 (db-postgres and db-sqlite). Two more effects of the null req.locale that are worth covering in the fix:
Reads without a where don't fail, they silently drop localized fields.GET /api/pages/1 (no ?locale=) returns 200 with every localized field missing (title, slug, …); with ?locale=de the fields are there.
Globals are affected the same way, and a hook can't work around it.GET /api/globals/header returns localized fields as null. For collections, a beforeOperation hook that sets the default locale works, because findOperation reads req.locale after beforeOperation:
consthook=({ args, req })=>{if(!req.locale)req.locale=config.localization.defaultLocalereturnargs}// added to every collection's hooks.beforeOperation
But globals/operations/findOne destructures req: { fallbackLocale, locale }before it runs the global's beforeOperation hooks, so the same hook has no effect on globals. A rewrite in Next middleware (?locale= appended) doesn't help either, because the REST handler reads the original request.url.
So a fix in sanitizeLocales (default to defaultLocale when no locale is given, independently of fallback) would cover collections, document reads and globals at once.
Activity
wyspaway commentedon Oct 9, 2026
Same root cause hit here on 3.88.0 (db-postgres and db-sqlite). Two more effects of the null
req.localethat are worth covering in the fix:Reads without a
wheredon't fail, they silently drop localized fields.GET /api/pages/1(no?locale=) returns 200 with every localized field missing (title,slug, …); with?locale=dethe fields are there.Globals are affected the same way, and a hook can't work around it.
GET /api/globals/headerreturns localized fields asnull. For collections, abeforeOperationhook that sets the default locale works, becausefindOperationreadsreq.localeafterbeforeOperation:But
globals/operations/findOnedestructuresreq: { fallbackLocale, locale }before it runs the global'sbeforeOperationhooks, so the same hook has no effect on globals. A rewrite in Next middleware (?locale=appended) doesn't help either, because the REST handler reads the originalrequest.url.So a fix in
sanitizeLocales(default todefaultLocalewhen no locale is given, independently offallback) would cover collections, document reads and globals at once.