Unknown type (SliceName) when building with Vercel

Hi there,

I running into a strange situatie where my query doesn't work on when deploying my Next.js application with Vercel. I have 2 slices on my homepage which I try to query (Masonry and Card). When I run the build locally everything works as expected and it's build. However when I push my code to the server I see this error in my build:

Query does not pass validation. Violations:
10:21:57.691  	Cannot query field 'allHomepages' on type 'Query'. (line 3, column 7):
10:21:57.691  	      allHomepages {
10:21:57.691  	      ^
10:21:57.691  	Unknown type 'HomepageBodyMasonry'. (line 20, column 22):
10:21:57.691  	              ... on HomepageBodyMasonry {
10:21:57.691  	                     ^
10:21:57.691  	Unknown type 'HomepageBodyCard'. (line 34, column 22):
10:21:57.691  	              ... on HomepageBodyCard {
10:21:57.691  	                     ^

My query is as followed:

    {
      allHomepages {
        edges {
          node {
            _meta {
              uid
            }
            body {
              ... on HomepageBodyMasonry {
                type
                primary {
                  title
                  description
                  full_width
                }
                fields {
                  img
                  img_title
                  img_desc
                  size
                }
              }
              ... on HomepageBodyCard {
                type
                primary {
                  title
                }
                fields {
                  full_width
                  img
                  img_first
                  title
                  title_center
                  body1
                  text_center
                }
              }
              __typename
            }
          }
        }
      }
    }

I checked if my env variables are working as expected in Vercel and everything seems to be fine. Anyone know if im doing anything weird query or sees any weird code?

Thanks in advance

1 Like

Hi Jose,

Thanks for posting! I couldn't reproduce your error, so I need some more information. Is your project in a public GitHub repo that you can share with me? If not, can you zip the project files and send them to me in a DM? Please include your repo name, too.

Thanks,
Sam

Removed the project completely from Vercel, deleted my project locally and cloned it again. This solved the issue for me. Very weird behaviour, anyway thanks for your time and have a nice day! :slight_smile:

1 Like

That's great to hear! Thanks for the update, Jose.

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