I've worked on Prismic and everything worked great on that project, but now I am working on a new one with different account, and I'm having difficulty connecting/fetching data this time.
I followed the Next.js Prismic documentation, but I keep getting this error-"An invalid Prismic repository name was given" I am not sure why.
Hello @hi16, thanks for reaching out.
Did you use a starter to kickstart this new project? Sometimes you need to ensure Slice Machine is configured with your repository name instead of the one provided by default on the starter's sm.json. Are you able to run Slice Machine?
Is there any other possible reason that this doesn't work? I'm trying to find an error but everything seems to be same as documentation. I cannot get rid of this error. I've tried creating another repository and configure again but it gives same error with this account
Hey @hi16, One of my colleagues was able to spot something in the code you shared:
You're importing createClient() from @prismicio/client from the page.js file. Instead, it should be imported from prismicio.js. Like this:
import { createClient } from "../prismicio";
The createClient() from prismicio.js already has the Prismic repository’s endpoint configured and is enhanced to support Next.js’s Preview Mode via the previewData option. With that import change, the “Invalid Prismic repository name” error should go away.