New client response error "Required attribute: contentInLocales"

Hi there,

I built and maintain, which uses Dato and Auth0 to allow our members to edit their profiles, which are simple Dato entries. It’s worked very reliably for going on 3 years now across a Gatsby and now NextJS frontend, so first off thank you for building this platform!

Recently my users have been unable to edit profiles, and my Netlify function for updating their profile fields returns the following error response:

  message: "Required attribute: contentInLocales"

I haven’t been able to find any reference to a contentInLocales attribute anywhere in the documentation, so I’m unsure where or how to add this attribute to my payload. Is this is a per-field sort of localization attribute?

Here are my JS client versions:

  • @datocms/cma-client-browser”: “^1.1.12”
  • @datocms/cma-client-node”: “^1.1.12”

I also just retried after updating them to 2.0.0, but I didn’t expect it to change anything and it didn’t.

To make my updates to the profile entries, within the updateKey Netlify function (source code here, sorry I haven’t gotten to migrate it to TS yet), simply passing the new payload from their edited profile field into the client.item.update() function.

This has worked well for a long time, so I’m uncertain what could have changed? We have just one default locale, en, so I don’t know what localization constraint is being imposed here.

Hello @frank.ringofkeys ,

Now you can publish only select locales so the structure of the call has changed, with new required parameters: Publish a record - Record - Content Management API

However, the old way to do the calls should be compatible with this change, and should not error out.
Are you using the /cma-client-node 2.0.0 to do those calls? I’ll try and reproduce this issue and get back to you as soon as possible.

In the meantime, changing the call to reflect Publish a record - Record - Content Management API should work, sorry about this!

Thanks @m.finamor! I had been looking at the docs to update a record, and hadn’t traced the error thoroughly enough to determine that it’s only required when publishing, which I also do in that function. I’ll add that parameter and check again, then get back here.

No I started seeing the errors even as I continued to use ^1.1.12 of cma-client-node; I only tried bumping the version as a naive last attempt to get a different error. I may be missing something, but it does appear to be a backwards compatibility break.

@m.finamor I’m running into an issue with this command - when i pass [' '] to content_in_locales when trying to publish a record with the API, I keep getting an error with content_in_locales even though all code samples use this value.

422 Unprocessable Entity

    "id": "xxx",
    "type": "api_error",
    "attributes": {
      "code": "INVALID_FIELD",
      "details": {
        "field": "content_in_locales",
        "code": "VALIDATION_INVALID"

@frank.ringofkeys, sorry, this seems to have fallen through the cracks a few months ago!

We are re-investigating this issue now as a bug and I’ll let you know what we find. Sorry for the delay!

In the meantime (if it’s not too late…) there is a workaround described here: `content_in_locales` field in publish API function - #2 by roger