If you've tried deploying a Next.js app with Google Genkit to Vercel and hit this error:
Module not found: Can't resolve '@grpc/grpc-js'
or any Edge Runtime incompatibility error related to gRPC — this post is for you.
The Problem
Genkit uses gRPC under the hood for some of its internal communication. Vercel's Edge Runtime does not support Node.js native modules like gRPC. This means any Genkit import in a file that gets bundled for Edge Runtime will cause the entire deployment to fail.
The error is cryptic. The build logs don't always point directly at Genkit. I spent hours chasing TypeScript errors and stale commits before finding the real issue.
The Fix
Remove the Genkit AI module entirely from any file that runs on the Edge Runtime. In my case, I had to remove the entire AI integration from the API route and move the logic server-side only.
If you're using Next.js, make sure your Genkit calls only happen in files that run in the Node.js runtime, not Edge. Add this to your API route if needed:
export const runtime = 'nodejs';
Other Issues I Hit
Beyond the gRPC error, I also dealt with TypeScript errors blocking the build and a stale commit deployment where Vercel was deploying an old version. Always check your deployment logs and confirm the commit Vercel is actually building.
The Result
After removing the AI module from the Edge Runtime context, the app deployed cleanly. I later moved API keys to environment variables and added Firestore-based rate limiting.
The live app is Repo Ranger — a GitHub repository discovery tool at studio-gules-one.vercel.app
Top comments (0)