Custom Types API: newly created types not recognized by CDN Route Resolver until manual UI action

Description:

When creating a new custom type via the Custom Types API and then immediately querying documents, the Route Resolver throws an "Unknown type" error for the
newly created type.

Steps to reproduce:

  1. Create a new custom type (e.g. my_new_type) via the Custom Types API (POST /customtypes)
  2. Add the type to the routes array passed to createClient():
    { type: 'my_new_type', path: '/:uid' }
  3. Query any documents whose links reference the new type (e.g. client.getAllByType('some_existing_type') where documents contain Link fields pointing to my_new_type documents)

Expected behavior: The query succeeds. The new type is immediately available for route resolution.

Actual behavior: The query fails with:
Error: [Link resolver error] Unknown type
Declared type: my_new_type
Expected one of: [list of all previously existing types, but NOT the newly created one]

Workaround: Go to the Prismic UI, open the new custom type, make any change (or just save), and then the query succeeds. This suggests the CDN type registry is only refreshed after a UI-triggered save, not after an API-triggered creation.

Impact: This breaks CI/CD workflows where we sync custom types via the API before building. The sync step creates the type successfully, but the subsequent build fails because the CDN doesn't recognize it yet. We have to manually intervene in the UI after every new type creation, defeating the purpose of API-driven sync.

2 Likes

I can confirm I've run into the same issue. The manual UI save workaround works thanks!

Would love to see this fixed!

Hi everyone,

I am experiencing the exact same issue, and it is really, really annoying.

This completely breaks our CI/CD workflows. The whole point of using the Custom Types API is to automate our deployments. Right now, our sync step successfully creates the type via the API, but the build immediately fails afterward because the Route Resolver throws this Unknown type error.

Having to manually log into the Prismic UI just to hit "save" and force the CDN to refresh completely defeats the purpose of having an automated process. The API should trigger the same cache invalidation as the UI does.

Is there a fix planned for this soon? As it stands, it makes automating Custom Types almost unusable for us.

Yeah, but when you have to sync 20 repositories, it's just a real hassle !

Hello all,

In order for us to investigate, could you all share which repositories you are working from? Thank you!

@stephane.douzima.ext, can you confirm if you're doing anything else with the UI after creating the Custom Types API? Saving does not republish the API, so it must be something else, maybe with a document? Let me know.