Vercel not deploying latest GitHub commit (Next.js App Router) — what am I missing? #183763
Replies: 3 comments
-
|
hi, @paidterms
Summary: Make sure Vercel is connected to the right repo and branch, pushes trigger deployments, and your project root and API structure are correct. Use Vercel’s dashboard to check deployed commit SHAs and manually redeploy if needed. |
Beta Was this translation helpful? Give feedback.
-
|
Vercel where production doesn’t seem to reflect the latest commits on my GitHub main branch. Locally everything works as expected (including App Router API routes and Stripe webhooks), and the latest commits are visible on GitHub, but in production Vercel is serving older code: newly added routes return 404/405 and the build logs don’t show the most recent commit hash. I’ve tried manual redeploys from the Vercel dashboard, verified that the commits exist on GitHub, and confirmed that the local build succeeds, which makes me unsure whether Vercel is linked to the correct repository, branch, or project root, or if there’s something about App Router API route structure that behaves differently in production. I’d really appreciate any guidance on how to confirm which branch and commit Vercel is actually deploying, common reasons Vercel might serve stale builds, or the proper way to force a fresh production deployment from main. |
Beta Was this translation helpful? Give feedback.
-
|
This behavior almost always means Vercel is not deploying the same Git ref you think it is, not that Next.js or App Router is broken. Here’s the mental model that helped me debug this class of issues: 🔍 How Vercel actually decides what code to serve Vercel deploys a specific commit SHA, not “whatever is on GitHub” “Production” is just a label pointing to one deployment If that deployment wasn’t triggered by the latest main commit, you’ll see: Missing App Router API routes 404 / 405 for handlers that exist locally Build logs showing an older SHA 🧠 Why App Router makes this feel confusing App Router API routes are: Tree-shaken at build time Fully static in output Those routes literally do not exist in the deployed artifact That’s why this never reproduces locally. 🚨 The 3 real-world causes I’ve seen (in order of frequency) Production branch mismatch Project still pointing to master or a preview branch Wrong project root Build succeeds, but from an older directory layout Repo drift Vercel linked to a fork / old repo / renamed repo ✅ How to prove it (not guess) Open the current production deployment Copy the commit SHA Compare it to: git rev-parse origin/main If they differ → mystery solved. 🔁 Nuclear reset (when in doubt) Disconnect GitHub from the Vercel project Re-link the correct repo Set production branch explicitly Trigger a fresh deploy This isn’t about “forcing” Vercel — it’s about ensuring the deployment trigger → commit → build artifact chain is aligned. Once that chain is correct, App Router + Stripe + Supabase behave exactly as expected. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
I’m building a Next.js App Router project (Stripe + Supabase) and I’m stuck on what feels like a basic but confusing deployment issue.
What I’m trying to achieve:
I want my production site on Vercel to always reflect the latest commit on my GitHub main branch. When I push code, Vercel should automatically build and deploy that exact commit.
What works:
The app works locally
API routes work locally
Stripe webhooks fire correctly locally
Git commits and pushes appear correctly on GitHub
The problem:
Vercel is not deploying the latest commit from GitHub.
Production is serving older code, and routes that exist locally (e.g. /api/version, new GET handlers) return 404 / 405 in production.
In Vercel:
The build logs don’t show the latest GitHub commit hash
The deployed version seems tied to an earlier commit
I’m not sure if Vercel is watching the wrong branch, wrong repo, or wrong project root
What I’m confused about:
Whether Vercel is actually linked to the correct GitHub repo + branch
Whether my App Router API routes are structured incorrectly for production
How to force Vercel to deploy a specific commit or resync with GitHub
What I’m hoping to understand:
How to confirm which branch + commit Vercel is deploying
Common reasons Vercel serves stale builds
The correct way to force a fresh production deployment from main
If anyone’s hit this before or can sanity-check my mental model, I’d really appreciate it.
Optional comment you can add (if people ask “what have you tried?”)
Manual redeploy from Vercel dashboard
Verified commits exist on GitHub
Confirmed local build works
Checked API route paths for App Router (app/api/**/route.ts)
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions