process.env works in local development but is missing after deploying to cloudflare workers
client-side secrets through import.meta.env work both locally and on deployed worker. Server-side secrets using process.env doesn't exist when deployed. I'm using workers not pages using these as reference:
https://developers.cloudflare.com/workers/framework-guides/web-apps/tanstack/
https://charleswilliamson.com/how-to-deploy-tanstack-start-to-cloudflare-workers/
Cloudflare Docs
TanStack
Create a TanStack Router application and deploy it to Cloudflare Workers with Workers Assets.
Charles Williamson
How to deploy Tanstack Start to Cloudflare Workers
TanStack Start is currently in beta - this blog post works, as of 20/4/2025. I will aim to periodically return to this blog post and update it, if any braking changes have been released
Why Workers instead of Pages?
The Tanstack Start hosting page currently has a section
2 Replies
other-emeraldOP•3mo ago
Just had to upload the secrets to the worker using wrangler.
conscious-sapphire•3mo ago
I have it working here https://github.com/bonadio/tanstack-start-cloudflare-workers
GitHub
GitHub - bonadio/tanstack-start-cloudflare-workers
Contribute to bonadio/tanstack-start-cloudflare-workers development by creating an account on GitHub.