MIDDLEWARE_INVOCATION_FAILED
what this Vercel error means
How it shows up
500 MIDDLEWARE_INVOCATION_FAILED
What it means
The Routing Middleware that runs before your pages failed while handling the request, for example because of an unhandled error in its code, so Vercel returned 500 Internal Server Error.
The usual cause in an AI-built app
AI tools often add a middleware file that creates a Supabase client to refresh the session on every request. If the Supabase URL or key variables are missing on Vercel, that middleware throws on every page.
Check this first
In your Vercel project settings, check that every environment variable your middleware file reads is set for the environment you deployed to.