Route Resolver CORS Error... too many routes?

Hello!

I'm running into an issue with a big project that I'm building using Nuxt.js with the Prismic module and slicemachine.

When I tried adding a new route today to my routes resolver config, Prismic breaks throughout my site with a 502 error: has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I've made sure that:

  1. My custom type's id is properly declared and exists in my prismic repo.
  2. There is at least 1 existing document of this custom type.

Those usually cause this error but seem to be okay. My theory is I declared way too many routes and there is a limit, because I tried removing another route from my config and replacing it with the new one and it still works, but adding it back breaks the site again.

Is there a limit to how many routes you can add to the route resolver with the @nuxtjs/prismic module? What else could be causing my issue?

1 Like

Hello Daniela, check out this response I added to a similar issue not long ago, maybe you'll find it useful:

Thanks for your response! I don't know if these apply since I'm not using the GraphQL API, just the @nuxtjs/prismic module :frowning:

As far as I've tested, the error only happens when adding more routes to my route resolver (that has about 35 routes) and works fine when reducing the amount, no matter which ones I add / remove. This makes me think that it has to do with a length limit, but I can't find any documentation on it at the Prismic docs!

I removed some routes from the resolver as a temporary fix but I will need to use them later. If anyone has more info or knows how to work around this, please let me know. :slight_smile:

1 Like

Hi,
I am running into the same problem - it seems to be a bug related to the number of routes in the config. Have you found any solution @danyaviless18

Thanks

For anyone running into this issue:
You can use the linkResolver for some routes and then remove those routes from the array.
I know it is not the perfect solution as those links be resolved client side - but still at least everything is up and running again :slight_smile:

2 Likes