UID not set in my entries

Hi,

my custom type has a UID field. Even when not empty, the UID is not returned:

CleanShot 2022-05-05 at 11.11.18

I now fixed the implementation to first look in uid and then slugs, but that looks like sort of a hack. If I have a UID field in the type, I thought it was guaranteed to always get a UID?

Thanks
Jannik

Hello @j.zschiesche

Thanks for reaching out to us.

Slugs are a deprecated feature used before we introduced the UID field. We don't recommend using them and thus don't provide any resources. You can still find them in your document object for anyone with a legacy setup that uses them.

About your UID field:

  • Have you filled the UID value in the documentation?
  • Have you published the document?

Thanks,
Priyanka

Hi,

yeah I know that, however if I don't get the values in the correct field, then I have no choice. :slight_smile:

Field is filled out:
CleanShot 2022-05-09 at 09.54.43

The API returns null:
Uploading: CleanShot 2022-05-09 at 09.53.55.png...

And apparently there is seems to be missing validation in the configuration of the field? At least when I now try to edit the custom type in the admin UI (normally I always push them via the API) it just doesn't load and completely breaks (just a blank white page) with this error:

CleanShot 2022-05-09 at 09.55.38

If it is not allowed to change the name, then why is the UID field even configurable?

Thanks
Jannik

Hey @j.zschiesche, thanks for sharing your use case.

  • Are you using Slice Machine
  • Have you edited the UID field's API ID in the JSON model? This could cause conflicts in your documents
  • If the error persists, could you share with us the URL of your repository?

Hi,

we are not using slice machine, we use a different stack for connecting to Prismic.
We are using the Content Types API and push our types. But apparently there seems to be some constraints that are reflected in Slice Machine and not in the API itself?

Cheers
Jannik

Ok, I see.
It is weird because the UID is the only required field existing in Prismic.
If you add it to a document, then it can't be equal to null because, as you've seen, even if you don't type anything, the field will be autocompleted with the first string it detects.

Can you show us the query for the document in the screenshot? We'd like to see how this looks like in the API.

So,

our repository is flex-elektrowerkzeuge.
The query I used is [at(document.type, "product-application")]

It's possibly related to my description above. The API is missing some crucial validation and therefor breaks assumptions but the internal code.

Thanks
Jannik

There aren't any additional constraints in Slice Machine. It works in the same way as the Legacy Builder. UID fields must be filled in each document of the Type that has it. Otherwise the UI doesn't allow you to publish the document.