Repository navigation
api: /api/version names the deployed commit - #16
Merged
Merged
Conversation
It returns VERCEL_GIT_COMMIT_SHA, and its ref when known, so a deploy can be read back against the history. A deployment that does not know its commit answers 503 rather than guess. It is one more op on the site router, so the function count stays under the Hobby plan's 12.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
azank1
marked this pull request as ready for review
October 15, 2026 09:47
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
GET /api/version, which returns{"commit": VERCEL_GIT_COMMIT_SHA, "source": "env:VERCEL_GIT_COMMIT_SHA", "ref": VERCEL_GIT_COMMIT_REF}withCache-Control: no-store, so a deploy can be read back and checked against the history. A deployment without a full commit id answers 503 instead of guessing.It is one more op on the existing
api/site.tsrouter plusversionin the/api/:op(...)rewrite, so no new function is added (Hobby cap of 12)./versionis untouched and still reaches the page for a user namedversion.Evidence. Typecheck clean; web suite 63 pass, 0 fail, 6 skipped (the existing live-network tests). New tests: the rewrite maps
/api/versionto/api/site?op=version, and the handler returns the commit when set and 503 when it is missing, empty or abbreviated.Read back on the preview.
GET /api/versionon the Vercel preview for this head (read through Vercel's authenticated fetch) answered 200 with{"commit":"b38260939b404d3129ae5adfd70a75ec4ab251b8","source":"env:VERCEL_GIT_COMMIT_SHA","ref":"feat/version-route"}andcache-control: no-store, so the system environment variables do reach functions at runtime.CI. web and python pass. viewer fails, and it fails on
mainat5d37aaethe same way: the build regeneratesweb/public/index.htmland it differs from the committed copy. That predates this PR, which does not touch the viewer.