Merged my work into preview branch, now nextjs won't compile

I was working on my development branch, all was just working perfectly fine. When I merged the branch into preview, both branches stop compiling. Starting next dev, just is stuck on compiling. Only when remove anything Prismic, it compiles again. I am new to Prismic and overall I enjoyed it but if this breaks if you do simple merge, this is useable at all.

I tried reinitialise the slice machine but that only broke slice machine with the following error: Pulling existing types...
Error: Invalid context provided

Starting again might fix but this is not going to be safe for production if this just breaks when we merge our code.

Hi Olaf,

Welcome to the community :slight_smile:

I'll be happy to help. Although I'll need more information.

What exactly did you remove and re-add? Did you remove files etc?

Are you trying to cache anything on Vercel?

Thanks.

Hi Phil,

I am using an NX monorepo, which has been one of the stumbling blocks with using Prismic. To get things working, I added a package.json file to the app/myapp folder. However, Netlify does not allow .lock files in any folder other than the root. This was one of the issues that caused the site to fail. Now, I'm experiencing strange issues, such as server functions occasionally failing on Netlify, and I'm no longer able to get previews in the CMS—I just receive an error message. Do you have any idea how to fix this? I removed the package.json and yarn.lock from apps/kids-guitar-dojo . Any idea why the preview is broken now?

Cheers
Olaf

Hi Olaf,

Is this the same issue that you resolved in your other threads?

Yes, here is final config if you use Clerk for authentication:

export const config = {
  matcher: [
    // Skip Next.js internals and all static files, unless found in search params
    '/((?!_next|slice-simulator|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
    // Always run for API routes
    '/(api|trpc)(.*)',
  ],
};
`
1 Like