Deployment on Cloudflare Workers
The documentation currently only explain how to deploy on Cloudflare Pages. Is the any sort of guide for deploying to workers?
20 Replies
fascinating-indigoOP•6mo ago
Additionally is there any ways to get development closer to the deployment target? If you follow the guides for "build from scratch" and then the hosting guide for pages, you end up with e.g. "node:fs" as an import which doesn't seem to fail when running npm dev
passive-yellow•6mo ago
I am looking to do the same, but I think it'll be easier once Vinxi is gone. Start will just be a Vite plugin, and Cloudflare also has a Workers Vite plugin to make things easier
harsh-harlequin•6mo ago
yep!
fascinating-indigoOP•6mo ago
Any timeline on this move off of Vinxi?
harsh-harlequin•6mo ago
hopefully soon, few weeks
evident-indigo•6mo ago
Did somebody actually managed to get a deployment to CF Workers done?
We are looking into that because we want to fully control the deployment (to certain envs via GH actions)
passive-yellow•6mo ago
I got this working: https://discord.com/channels/719702312431386674/1238170697650405547/1351932696162730085
But I am holding off and revisiting once Start is simplified into a Vite plugin
fascinating-indigo•5mo ago
backpine labs (@backpinelabs) on X
If anyone is wondering how to ship a @tan_stack start application to Cloudflare Workers (with access to CF bindings) I have a working example.
Bindings are accessible in production and locally even when using vinxi dev.

X
solid-orange•5mo ago
can confirm the above works, just did it
at least with KV, trying now R2
fascinating-indigo•5mo ago
Curious about if durable objects work
fascinating-indigoOP•5mo ago
How the heck does it work in local for you, if a) not all used packages are declared in the package.json and b) the bindings locally seem to be a promise, which is not awaited? Sample above without changing that is not working for me. After changes it seems fine, but has still a few type errors based on the settings it ships with
wise-white•5mo ago
is there a github link or something for this ?
exotic-emerald•5mo ago
its in the comments of the tweet
passive-yellow•5mo ago
Not having any luck with this approach. Even cloning the repo
national-gold•5mo ago
GitHub
GitHub - bonadio/tanstack-start-cloudflare-workers
Contribute to bonadio/tanstack-start-cloudflare-workers development by creating an account on GitHub.
absent-sapphire•5mo ago
I can’t get this working. I tried the approach on the repo as well with no luck
genetic-orange•5mo ago
You can also give Alchemy.run a try. I used it to deploy to CF and it's pretty easy to setup.
https://alchemy.run/docs/guides/cloudflare-tanstack-start.html
Alchemy
Alchemy: Typescript-native Infrastructure-as-Code
national-gold•3mo ago
I updated https://github.com/bonadio/tanstack-start-cloudflare-workers to work with the latest version
GitHub
GitHub - bonadio/tanstack-start-cloudflare-workers
Contribute to bonadio/tanstack-start-cloudflare-workers development by creating an account on GitHub.
sunny-green•3mo ago
Getting this error:
error during build:
Error: Cannot resolve "tanstack-start-server-fn-manifest:v" from "/Users/kevinminh/Developer/tanstack-start-template/node_modules/.pnpm/@tanstack+start-server-core@1.121.12/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js" and e
national-gold•3mo ago
Working here:
/tmp/tanstack-start-cloudflare-workers
(base) -> npm run build
tanstack-start-cloudflare-workers@1.0.0 build vite buildvite v6.3.5 building for production... Generated route tree in 207ms ✓ 130 modules transformed. .tanstack/start/build/client-dist/.vite/manifest.json 1.19 kB │ gzip: 0.30 kB .tanstack/start/build/client-dist/assets/index-BObhGw7g.js 0.13 kB │ gzip: 0.13 kB .tanstack/start/build/client-dist/assets/teste-DaZjm9bz.js 0.30 kB │ gzip: 0.22 kB .tanstack/start/build/client-dist/assets/deferred-CffD8pO0.js 0.34 kB │ gzip: 0.25 kB .tanstack/start/build/client-dist/assets/main-Bakroip1.js 276.09 kB │ gzip: 88.38 kB ✓ built in 2.21s vite v6.3.5 building SSR bundle for production... "H3Error", "MIMES", "callNodeListener", "createApp", "createAppEventHandler", "createError", "createEvent", "createRouter", "sanitizeStatusMessage", "serveStatic", "splitCookiesString", "toEventHandler", "toNodeListener", "toPlainHandler", "toWebHandler" and "useBase" are imported from external module "h3" but never used in "node_modules/@tanstack/start-server-core/dist/esm/h3.js" and "nodemodules/@tanstack/start-server-core/dist/esm/index.js". ✓ 56 modules transformed. ✓ built in 397ms ✔ Generated public .output/public nitro 1:21:30 PM [nitro 1:21:31 PM] ℹ Building Nitro Server (preset: cloudflare-module, compatibility date: 2024-11-13) ✔ Nitro Server built nitro 1:21:39 PM ├─ .output/server/chunks//_tanstack-start-manifest_v-B6Oaf-jF.mjs (562 B) (317 B gzip) ,........ Σ Total size: 564 kB (167 kB gzip) ✔ You can preview this build using npx wrangler --cwd .output/ dev nitro 1:21:39 PM ✔ You can deploy this build using npx wrangler --cwd .output/ deploy nitro 1:21:39 PM [nitro 1:21:39 PM] ✔ Client and Server bundles for TanStack Start have been successfully built.