Run npx convex dev once, put the deployment URL in .env.local as NEXT_PUBLIC_CONVEX_URL, then restart Next.
npx convex dev
.env.local
NEXT_PUBLIC_CONVEX_URL