Repository navigation
Conversation
Add recordServerError, annotateServerResponse, serverErrorResponse and getAnonymousVisitorId. A full-stack (TanStack Start) app's Worker uses them, through the app template's middleware, to report its server errors to Base44 in the X-B44-Function-Error response header (v2), only when serving asks with X-B44-Capture-Errors: 1. No TanStack dependency and no new runtime dependency. Tests: Vitest units, a contract fixture checked against apper's read_function_error(version=2), and an end-to-end TanStack Start app built with @cloudflare/vite-plugin and run in Miniflare and workerd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'t fit - The root .gitignore's lib/ rule had dropped the e2e app's src/lib/error-capture-middleware.js, so the app couldn't build. - Escaping can grow a 500-byte message to 3,000 bytes (\u0001 per control character), so with name and fn the header could miss 3,072 bytes even without frames, and no report was written. Cut the message to the most code points that fit instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Server errors no longer travel in an X-B44-Function-Error response header: a Tail Worker on the dispatch Workers reads them, and the app template logs the error record itself. So the header helpers, their contract fixture and reader, and the end-to-end app and its CI job go. getAnonymousVisitorId() stays, moved next to getAnalyticsSessionId(), with its tests in the anonymous visitor header suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Exports
getAnonymousVisitorId(): string | nullfrom@base44/sdk. It returns the anonymous visitor id the SDK already sends asX-Base44-Anonymous-Idon requests made without a signed-in user. That'sgetAnalyticsSessionId(), stored underbase44_analytics_session_idinlocalStorage. It returnsnulloutside a browser, andnullif anything throws.getAnalyticsSessionId, the storage key and the axios interceptor are unchanged.Why
A TanStack Start app's server-function calls go through TanStack's own
fetch, not the SDK's axios client, so they don't carryX-Base44-Anonymous-Id. Without it, Base44 can't tell which signed-out visitor a server error affected. The app template has to add the header itself, and this export lets it read the same id the SDK sends, instead of reaching into the SDK's storage key. Until a release includes it, the template readsbase44_analytics_session_iddirectly, so nothing is blocked on this PR.The tests pin that contract:
getAnonymousVisitorId()returns the same value an unauthenticated client sends asX-Base44-Anonymous-Id.What was dropped
This PR first added helpers that reported server errors in an
X-B44-Function-Errorresponse header:recordServerError,annotateServerResponse,serverErrorResponse, the header format, size budget, stack-frame parsing, a contract fixture, and an end-to-end TanStack app with its CI job. They're gone. The plan changed on 2026-10-14: a Cloudflare Tail Worker on the dispatch Workers now reads errors (decision 33), and the app template logs the error record from its own managed files (D13). So the SDK no longer holds any of it. See function-error-transport-alternatives.md (§4.7, and §11 rows D1, D11, D13) and thebase44/javascript-sdktable in function-error-pr-dispositions.md.The removed end-to-end app is recoverable at commit
c185498. Its two findings now live in the apper template work:serverFnMeta(name,filename,id), notfunctionId, to a function middleware.//# sourceURL=file:///…to each module, so frames show absolute local paths where a deployed Worker shows module names.No version bump; the release workflow does that.
🤖 Generated with Claude Code