fix(cloudflare): beta.61 integration bug reports — nodejs_compat default, StaticSite Config env, vite main resolution#796
Open
sam-goodwin wants to merge 2 commits into
Open
Conversation
…ult, StaticSite Config env, vite main resolution
Fixes from the create-better-t-stack integration reports:
- default nodejs_compat now reaches external Workers (plain `export default { fetch }`
entrypoints set isExternal, which excluded them from the default); gated on
compatibility date >= 2024-09-23 so pinned old dates don't get the broken v1 mode
- precreate placeholder spread getCompatibility() as date/flags — wrong metadata keys,
so the stub uploaded with no compatibility date or flags
- StaticSite serializeEnv resolves Config/Effect env values instead of JSON.stringifying
them into the build subprocess ({"_id":"Config"}); Outputs pass through for the
engine to resolve
- relative vite.main resolves from rootDir (the rolldown plugin resolves the worker
entry with no importer, so it resolved against process.cwd())
- memo include globs escaping cwd are documented + absolute matches normalized to
cwd-relative so machine paths never leak into the hash
- alchemy logs explains the missing workers_observability:read scope on Unauthorized
instead of surfacing the bare tag
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/5067066@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/5067066@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/5067066 |
- serializeEnv: null no longer throws on the ~alchemy/Kind probe; Output values are serialized after resolution via Output.map so Output<object> reaches the build subprocess as JSON, not [object Object] - getCompatibility: an explicit no_nodejs_compat opts out of the default nodejs_compat instead of sending Cloudflare a contradictory flag pair - memo monorepo examples pair ../ include globs with lockfile: true (include flips the lockfile default off) and MemoOptions documents the interaction - add a StaticSite regression test covering Config, Output<string>, Output<object>, and null env values reaching the build env (verified it fails against the previous serializer) Co-Authored-By: Claude Fable 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.
Fixes for the beta.61 integration bug reports from create-better-t-stack (repros). Every fix was verified by deploying the corresponding repro against a real Cloudflare account.
2. Default
nodejs_compatnever reached plain WorkersCloudflare.Worker("w", { main })(no Effect impl) setsisExternal: true, andgetCompatibilityonly added the defaultnodejs_compatfor Effect-native Workers — so a plain Worker importingnode:cryptobundled fine and then failed upload withScriptModuleNotFound. The default now applies to all Workers, gated oncompatibility.date >= 2024-09-23so a pinned old date doesn't get the legacy v1 mode (which lacksprocess.getBuiltinModuleand fails at script startup). An explicitno_nodejs_compatincompatibility.flagsopts out of the default.Also fixes a latent precreate bug found along the way: the placeholder upload spread
...getCompatibility(news)into metadata, producingdate/flagsinstead ofcompatibilityDate/compatibilityFlags— the stub deployed with no compatibility settings at all (spreads bypass excess-property checks).3.
StaticSitepassed unresolvedConfiginto the build envserializeEnvJSON.stringified anything that wasn't a string/Redacted, soenv: { MY_URL: Config.string("MY_URL") }reached the build subprocess as{"_id":"Config"}(overriding a correctprocess.envvalue). It now mirrors theWebsite.Viteenv path:A live regression test covers
Config,Output<string>,Output<object>, andnullenv values reaching the build subprocess.5/6.
vite.main— relative paths + docs/API driftViteOptions.main(documented "Custom Worker Entry") is threaded throughWebsite.Viteand now resolves relative paths againstrootDirin both the live and dev providers — the rolldown plugin resolves the worker entry with no importer, so a relativemainpreviously resolved againstprocess.cwd()and broke monorepo deploys.The plugin-side root causes of issues 4/5 (silent
export default {}wrapper, no-importer resolution) are fixed in the companion PR cloudflare-tools#62.7.
memoand monorepo workspace deps../include globs already escapecwdend-to-end; this documents the pattern onMemoOptions,StaticSite, andWebsite.Vite, normalizes absolute glob matches to cwd-relative (they previously brokehashFilesand would have leaked machine paths into the hash), and adds a live test covering rebuild-on-sibling-change.8.
alchemy logsUnauthorizedworkers_observability:readis already in the default OAuth scopes (including published beta.61), but tokens keep the scopes they were minted with — an older login fails the telemetry query with a bareUnauthorized. The query now dies with an actionable message pointing at re-runningalchemy login.Docs
Website.ViteJSDoc: SSR examples no longer instruct addingnodejs_compatmanually (it's the default), and a React Router example was added.Issue 1 (Vite SPA "neither assets nor server output") was already fixed on main by #795 — re-verified with the exact repro. Issue 8's poisoned
alchemy@2.0.0-pipeline-v2-testnpm release needs a maintainernpm deprecate.🤖 Generated with Claude Code