feat(academy): speed up the sample route, track it, and add the favicons - #353
Merged
Merged
Conversation
Academy and the console had none at all. FlexiQ keeps its own mark.
Functions defaulted to iad1 while Postgres is in ap-northeast-1, so every query crossed the Pacific and a cold connection cost five round trips of it.
"could not reach the database" was printed for a certificate Node would not verify and for a table that did not exist. The wrapper drizzle throws hides both under [cause]: [Error].
The receipt's failure is logged rather than surfaced, so the answer never depended on it — only on a second round trip to Resend finishing first.
Timed in the browser, which is the wait somebody actually sat through: the function's own timing cannot see their network or a cold start.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
kartikeya-27
approved these changes
Sep 19, 2026
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.
A sample request came back in 12.19 seconds. Chasing that turned up three separate things, and the favicons went in alongside them.
Why the route was slow
The function was in the wrong hemisphere.
apps/academyhad novercel.json, so its functions defaulted toiad1while Postgres sits inap-northeast-1. Every query crossed the Pacific, and a cold connection pays five round trips of it before the first row. The console already pinshnd1for exactly this reason; academy now does too.The response waited on an email nobody was waiting for. The receipt is sent after the work order, and its failure is logged rather than surfaced — the request is filed and will be delivered either way. So the answer never depended on it, only on a second round trip to Resend finishing first. It moves to
after()fromnext/server, which runs once the response is gone.That does not add up to twelve seconds on its own, so the rest is measured rather than guessed:
submitOrdernow logs what each step cost.Why the logs were useless
console.error("...: %s", cause)on the error drizzle throws prints the query and then[cause]: [Error]— the wrapper, and a promise that the reason is somewhere underneath it. Two different incidents read identically through that hole: a missing table, and a certificate Node would not verify.describe()walks the chain and prints each message with its code.Analytics
track()joins@byteveda/analytics/vercel, behind the sameNEXT_PUBLIC_VERCEL_ENVguard as the sinks — off Vercel there is no endpoint to receive an event, and a local run or the e2e suite should not report a funnel nobody is watching. Deleting that one file is still the whole cost of leaving Vercel.The sample page sends
sample_requestedandsample_failed, both with the kind and the duration. Timed in the browser on purpose: that is the wait somebody actually sat through, including their network and any cold start, none of which the function's own timing can see.Favicons
The ByteVeda mark now covers
main,docs,academyandadminasfavicon.ico,icon.pngandapple-icon.png. Academy and the console had no icon at all; main and docs had a placeholder book mark and no.ico. FlexiQ keeps its own mark — it is a distinct product and already had the full set.Plain Next file conventions, no
metadata.iconsanywhere to wire up. Verified in the docs static export:Verification
pnpm typecheckacross all ten packages, Biome clean on everything touched, 22 academy unit tests, 51@byteveda/dbtests, 26 academy Playwright tests, and a build of all five apps.Still outstanding
Academy's
DATABASE_URLin Vercel points at port 5432, the session-mode pooler: every connection is pinned for the life of the instance andpoolMaxdrops from five to two. It wants 6543. That is an environment change, not a code one — the migrate step rewrites the port for itself, so migrations are unaffected either way.