Cannot retrieve data for my custom type in Slice Machine project

Hello all,

I'm having some issues in our Next.js + Slice Machine project.

We set up the project as per the Prismic documentation and were able to bring data back from our Prismic repo with the included page custom type, in /pages/[uid].js.

We have since created our own article custom type, in a folder /pages/article/[uid].js, and followed the steps to query content outside the Slice Zone. However, when viewing my published article locally at the correct path (like http://localhost:3000/article/test-article), the API response being passed to the component props is as follows:

{ error: null, slices: [] }

When viewing the test page that does pull data from Prismic, the props are populated with the UID, data, document type, slices, and all of the things I would expect to come back.

This would suggest to me that Prismic is having trouble resolving the route for my published page. But if I navigate to a route that has no published page for it, with a UID that does not exist, the props yield a blank object { }.

Has anyone experienced anything similar to this? Happy to share some code if it would help.



Hi there,

Welcome to the Prismic community.

I gave this thread some time hoping to get a response from the community.

To debug this issue, I would need some more info, so you can please list here the linkResolver or give us access to your code.

It would also be useful to share your repository name (in a private message if necessary).

Looking forward to your reply,

Hi Fares,

Our team have now resolved this issue.

It turns out the UID function in the useGetStaticProps() hook provided by the next-slicezone package needed adjusting to correctly get the UID.

Instead of:

export const getStaticProps = useGetStaticProps({
  client: Client(),
  type: 'inspiration',
  uid: ({params}) => params.uid

It needed to be:

export const getStaticProps = useGetStaticProps({
  client: Client(),
  type: 'inspiration',
  uid: function (param) {
    return param.params.uid;

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.