Issue with build process after making a small change in Vercel deployment
This is a classic dependency version conflict issue between sanity-plugin-media and react-hook-form. The error occurs because @hookform/resolvers (used by the media plugin) is trying to import a set function that doesn't exist in older versions of react-hook-form.
The timing with Next.js 13.4.8's release is likely coincidental - what probably happened is that your lockfile got regenerated during the build, pulling in newer versions of dependencies that are incompatible with each other.
Here's how to fix it:
- Update react-hook-form to a compatible version (v7.43.0 or higher includes the
setexport):
npm install react-hook-form@latest- Ensure @hookform/resolvers is compatible:
npm install @hookform/resolvers@latest- Clear your lockfile and node_modules to ensure clean dependency resolution:
rm -rf node_modules package-lock.json
npm install- If you're still having issues, check your
package.jsonfor any version constraints that might be preventing the update. You want:
react-hook-form: ^7.43.0 or higher@hookform/resolvers: ^3.0.0 or higher
- Alternative: Switch to the official media plugin - If
sanity-plugin-mediacontinues to cause dependency issues, consider using Sanity's built-in asset management features or look for more actively maintained alternatives.
Why this happened: The sanity-plugin-media package has specific peer dependency requirements. When your build process ran, it likely resolved to incompatible versions of react-hook-form and @hookform/resolvers. The set utility was added to react-hook-form in v7.43.0, but older versions don't have it.
For Vercel specifically: Make sure to clear Vercel's build cache after updating your dependencies. You can do this in your project settings under "Deployments" → click the three dots menu → "Redeploy" with "Use existing Build Cache" unchecked.
You definitely don't need to start from scratch - this is purely a dependency version mismatch that can be resolved by aligning your package versions.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.