TanStackT
TanStack8mo ago
2 replies
nursing-lime

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/

{
    "name": "web",
    "$schema": "node_modules/wrangler/config-schema.json",
    "compatibility_flags": ["nodejs_compat", "nodejs_compat_populate_process_env"],
    "compatibility_date": "2025-04-01",
    "main": ".output/server/index.mjs",
    "observability": {
        "enabled": true,
    },
    "assets": {
        "directory": "./.output/public/",
    }
}
Cloudflare Docs
Create a TanStack Router application and deploy it to Cloudflare Workers with Workers Assets.
TanStack
Charles Williamson
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
Was this page helpful?