Repository navigation
fix(cloudflare): default nodejs_compat for plain Workers, resolve Config/Output in StaticSite build env, relative vite.main - #796
Merged
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/55258a1@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/55258a1@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/55258a1 |
- 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>
…lare-bugs-4f2db7 # Conflicts: # packages/alchemy/src/Cloudflare/Workers/Compatibility.ts # packages/alchemy/src/Cloudflare/Workers/LocalWorkerProvider.ts # packages/alchemy/src/Cloudflare/Workers/WorkerProvider.ts # packages/alchemy/test/Cloudflare/Website/StaticSite.test.ts
Covers the #796 default (Effect-native + external workers), the v2-date gate, the no_nodejs_compat opt-out, python_workers exclusion, and the cross-request-promise-resolution behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lute memo globs - deploy a plain worker importing node:crypto with no compatibility props — the end-to-end repro for the default-nodejs_compat fix - assert an absolute memo include glob hashes identically to its ../ form; this exposed fast-glob silently dropping absolute patterns when mixed with relative ones, fixed by rewriting absolute includes to cwd-relative in resolveMemoOptions Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sam-goodwin
added a commit
that referenced
this pull request
Jul 29, 2026
…swarm #972) into url redesign Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sam-goodwin
added a commit
that referenced
this pull request
Jul 29, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sam-goodwin
added a commit
that referenced
this pull request
Jul 29, 2026
…r-aggregating destroy Ports into the LocalProvider.make structure: - make-before-break serveWith (workerd scopes fork from rootScope, closed on cutover / closeWorkerd) from #863 - url/urls/domain Attributes + resolveLocalUrls wildcard-host handling from #977 (local urls no longer carry a trailing slash; tests updated to `${url}/path`) - ALCHEMY_WORKER_NAME env (#860), viteMain root-relative resolution (#796), toRuntimeBinding dev.remote param for send_email (#865) distilled bumped to main (0.30.2). Co-authored-by: Cursor <cursoragent@cursor.com>
filipfalcon
added a commit
to filipfalcon/alchemy-effect
that referenced
this pull request
Sep 14, 2026
`props.vite` was built by a duplicated arm inside the WorkerProvider that never consulted `ViteOptions.deriveAssets`; `makeViteSource` has existed since alchemy-run#1086 but was only reached for `props.source`. Dispatch both through `resolveSource`, and move the self-URL env resolution, the absolute `main` (alchemy-run#796), and the `base` manifest prefix into the vite source.
filipfalcon
added a commit
to filipfalcon/alchemy-effect
that referenced
this pull request
Sep 20, 2026
…rive asset routing from its build
Foldkit's `vite build` (`@foldkit/vite-plugin` 0.24+, `ssr.build`) emits
`dist/server/fetch.js`: a Web `fetch` handler with the built shell
embedded, its default export `{ fetch }`. That is a Worker entry, so the
Cloudflare plugin adopts it the way it adopts a TanStack Start server
bundle, and everything the resource did instead goes away: the `main` a
server-rendered app had to name, the Worker that read the shell back out
of the `ASSETS` binding, and the two asset-routing settings that failed
quietly when wrong.
The build also writes `foldkit.build.json` beside the handler, recording
which paths it prerendered, and keeps the unfilled `index.html` out of the
client output, so a server-rendered build needs no routing of its own: a
prerendered route is a file, and every other request, the front page
included, reaches the handler. A build with no manifest is client-only
and gets the single-page-application fallback, the default the other
clouds' Foldkit resources apply. Anything set in `assets` still wins.
`ViteOptions.framework: "foldkit"` names the framework whose build the
vite source knows how to read; a registry maps it to the deriver that
reads the manifest. It is plain data, so it crosses the dev-child
boundary and compares by value in props.
`props.vite` used to be built by a duplicated arm inside the
WorkerProvider that bypassed `makeViteSource`, which has existed since
alchemy-run#1086 but was only reached for `props.source`. Both now dispatch through
`resolveSource`, and the self-URL env resolution, the absolute `main`
(alchemy-run#796), and the `base` manifest prefix move into the vite source.
The SSR example drops its Worker, its `main`, and its asset settings. The
docs describe the delivery shapes and what the build derives for each.
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