Can't fetch any document using NextJS demo repo

Hi!

I created a repo based on this template: https://github.com/prismicio-community/slice-machine-starter-next

The only things I changed are:

  • apiEndpoint in sm.json, I set it to "https://<myRepo>.prismic.io/api/v2"
  • set accessToken in the prismic-configuration.js
  • changed Client to make it aware of access token. based on this guide: Next.js and Prismic - Prismic

I also ran slicemachine entrypoint and synced 2 custom types into my Prismic account:


Now the problem.

  1. Run yarn build. Everything works as expected:

  2. Go to Prismic web page and create page and menu documents:


  3. Run yarn build again and.....

I can't understand what I'm doing wrong, cause there are no error messages at all from Prismic side.

Note 1: I also tried default Client from this repo (without the diff above), result is the same
Note 2: I also tried to use pure client, result is weird, see "Unexpected end of JSON input" when requesting an object via client

Hey @Denis,

It looks like you might have deleted .cdn from the API endpoint. Is that the case? Your endpoint should be:

https://<myRepo>.cdn.prismic.io/api/v2

Sam

Hi Sam,

Yep, forgot to mention :unamused: I tried .cdn as well, but to prove it, here is my complete result of a git diff command (token is trimmed intentionally)

It again hangs until it reaches the timeout

Well guys I think I figured out what might be the issue. My account was registered a year ago and as far as I remember, there was no slice machine at that time. Yesterday I tried to register a fresh account in Prismic, and follow the same exact steps -- everything worked like a charm. But this is really strange to me, and unfortunately I spent like a day just in vain trying to figure out if I do something wrong. If you want to perform some debugging, my "old" account's repo is fbjorn, and fresh one (tied to second account) is fbjorn123. I'd still appreciate some information regarding this issue if possible.

Thanks!

Hey @Denis,

Were you using an old repo? Or was it a newly-created repo in your old account?

Sam

If you created the repo a year ago, it probably wouldn't work with Slice Machine, so that makes sense. Let me know if it keeps giving you trouble.

Sam