Access to fetch at 'https://{repository}.cdn.prismic.io/api/v2/documents/search?q=%5B%5Bat%28document.type%2C+%22promotions_list_page%22%29%5D%5D&ref={master_ref}&routes=%5B%7B%22type%22%3A%22page%22%2C%22path%22%3A%22%2F%3Auid%22%7D%5D&access_token=' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I think the issue has to do with the way I am declaring the route. Any help would be appreciated!
Welcome to the Prismic community, and thanks for reaching out to us.
I don't find any issue with how you define the routes. It seems correct to me. The issue is coming from something else. Please share your Prismic repository name and project source code (Github or Zip file).
I have checked your project, and there are multiple issues I found:
First, you have given type: "page", path: "/:uid", in your routes. There is no page Custom Type in your repository. Routes define how you will structure URL paths in your project. You need to update the types to match the Custom Types in your project and edit the paths to match the routing in your project. Learn more about Route Resolver..
Second, in App.js Routes path in the Routes component should match route resolver defining in routes.
Do you have a sample project that uses a route resolver? I have read the documentation
(Link Resolver and Route Resolver - Prismic), but without being able to see how the types are configured in the repo, it is difficult for me understand.
I am trying to create a nav menu that has categories and each category has sub-categories.
Example: Promotions // ('/promotions')
Priyanka,
In my navigation_menu custom type, the URL property in my first_level link is '/uid' rather than /${uid}
I'm likely doing something wrong, but I can't seem to find where to fix this. Please see below:
const client = createClient()
let docs = await client.getAllByType("family_trek")
console.log(docs)
The above code works but when i replace "family_trek" with "trek" which i have as a custom type in my prismic repo, it gives me the CORS error. I have been trying to debug this issue since 2 weeks now. i am also in touch with Pauline from your team but i havent found any resolution yet