Contentful logo

Contentful Community

createLocale returns 500

Hi,

I use js contentful-management sdk.
I’m trying to create new locales on the env.

my sample locale:
{
name: ‘German (Germany)’,
code: ‘de-DE’,
fallbackCode: null,
default: false,
contentManagementApi: true,
contentDeliveryApi: true,
optional: true
}

And what I see on the console:
[warning] Server 500 error occurred. Waiting for 2094 ms before retrying…

Screenshot 2021-07-14 at 15.34.48

I’ve seen fallbackCode is defined as string and not nullable. I got the value I tried to post from the current locales on the contentful. Anyway I’ve tried to set fallbackCode to empty string, too. The result is same.

Does anyone see any mistake here?
Thanks

Hi @huseyin ,

I investigated the issue and the the API returns error 500 when passing the default key. I believe it should be passed only for the first default locale, and when creating other locales is not needed. In my test, both payloads worked successfully:

{
   "name":"Italian",
   "code":"it-IT",
   "fallbackCode": null,
   "contentManagementApi": true,
   "contentDeliveryApi": true,
   "optional": true
}
{
   "name":"French",
   "code":"fr-FR",
   "fallbackCode": "en-US",
   "contentManagementApi": true,
   "contentDeliveryApi": true,
   "optional": true
}

Thank you Alma! That solves my problem