Dharmendra Jagodana
Founder of BuildBase. Builds the platform and the six products that run on it.
101 posts · page 5 of 9
Middleware redirect loop after login in the App Router
Your middleware sees no cookie and 307s to /login. Your login page sees a session and bounces back. Traced hop by hop, plus the matcher and cookie rules that decide where it turns around.
A permission change that has not taken effect yet
A role changed in the console or the SDK is enforced on the next request. What lags is an open tab, a 5-minute API key cache, or a role written by hand. Here is which.
A 429 when the quota should not be exhausted
A 429 on the usage endpoint is almost never the quota. Quota rejection returns 400. Here is how to reconcile the counter you read with the counter being enforced.
Stripe webhook signature verification failed in Next.js
One error string covers two different bugs. Five causes for a failed Stripe webhook signature in Next.js, ranked by how often each is actually it, each with its one-line test.
Token expired mid-request on a long operation
A 401 halfway through an upload, while the user is still signed in for another 29 days. Two clocks, not one, and the fix is a refresh before the call rather than a retry after it.
Why your webhook is rejected after five minutes
A BuildBase delivery older than five minutes fails verification before the signature is ever compared. Why the max age exists, and the four things that trip it legitimately.
How to enforce quotas server-side in Next.js
The record call is the lock, not the if-statement after it. How quota enforcement actually behaves on hard-cap and overage plans.
How to add a credits wallet in Next.js, and why the balance is not one number
Add a credits wallet in Next.js: sell packages, show the balance, spend FIFO from dated buckets, and warn before expiry. The balance is an aggregate over buckets, not a column you decrement.
How to change pricing without affecting existing customers in Next.js
Change SaaS pricing without affecting existing customers: publish a new plan version, leave subscriptions pinned to the old one, and decide what a v1 customer sees when you ship v3.
An annual and monthly toggle in Next.js, and why it is not a boolean
How to add an annual and monthly toggle in Next.js: why the display interval is not the billing interval, what happens to plan allowances, and where the savings percentage should come from.
Proration on plan change in Next.js, and why a downgrade needs the opposite setting
Proration on plan change in Next.js: why upgrades and downgrades need opposite proration behavior, and how to read direction without mistaking a yearly plan for a bigger one.
How to add a free trial without a card in Next.js
A free trial with no credit card in Next.js: turn the card requirement off on the plan version, then handle the part Stripe cannot - what your app renders, and who the gate lets through.