env.production.vars not working with cloudflare workers

This is my wrangler file:
name = "post-crawl-workers"
main = "dist/index.js"
compatibility_date = "2025-02-28"
compatibility_flags = []

[build]
command = "bun run build"

[vars]
BUN_VERSION = "1.2.0"
PUBLIC_GCLOUD_PROJECT_ID="8381521..."
# PUBLIC_GCLOUD_DATA_STORE_ID="ideaape-reddit_173..."
PUBLIC_BRIGHT_DATA_USERNAME = "brd-customer-hl_9774..."
PUBLIC_BRIGHT_DATA_HOST = "brd.superproxy..."
PUBLIC_BRIGHT_DATA_PORT = "22225"
PUBLIC_SUPABASE_URL = "http://127.0.0.1:54321"
PUBLIC_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIs..."

[env.production.vars]
PUBLIC_SUPABASE_URL = "https://hftzfahjwsb..."
PUBLIC_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIs..."

# The rate limiting API is in open beta.
[[unsafe.bindings]]
name = "ACCOUNT_TIER_ONE"
type = "ratelimit"
namespace_id = "1001"
simple = { limit = 2, period = 60 }

[[unsafe.bindings]]
name = "ACCOUNT_TIER_TWO"
type = "ratelimit"
namespace_id = "1002"
simple = { limit = 4, period = 60 }

[observability]
enabled = true
head_sampling_rate = 1 # optional. default = 1.
name = "post-crawl-workers"
main = "dist/index.js"
compatibility_date = "2025-02-28"
compatibility_flags = []

[build]
command = "bun run build"

[vars]
BUN_VERSION = "1.2.0"
PUBLIC_GCLOUD_PROJECT_ID="8381521..."
# PUBLIC_GCLOUD_DATA_STORE_ID="ideaape-reddit_173..."
PUBLIC_BRIGHT_DATA_USERNAME = "brd-customer-hl_9774..."
PUBLIC_BRIGHT_DATA_HOST = "brd.superproxy..."
PUBLIC_BRIGHT_DATA_PORT = "22225"
PUBLIC_SUPABASE_URL = "http://127.0.0.1:54321"
PUBLIC_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIs..."

[env.production.vars]
PUBLIC_SUPABASE_URL = "https://hftzfahjwsb..."
PUBLIC_SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIs..."

# The rate limiting API is in open beta.
[[unsafe.bindings]]
name = "ACCOUNT_TIER_ONE"
type = "ratelimit"
namespace_id = "1001"
simple = { limit = 2, period = 60 }

[[unsafe.bindings]]
name = "ACCOUNT_TIER_TWO"
type = "ratelimit"
namespace_id = "1002"
simple = { limit = 4, period = 60 }

[observability]
enabled = true
head_sampling_rate = 1 # optional. default = 1.
6 Replies
Kenny
KennyOP5d ago
These are the build logs on cloudflare workers:
17:07:18.645 - ratelimit: ACCOUNT_TIER_ONE
17:07:18.645 - ratelimit: ACCOUNT_TIER_TWO
17:07:18.645 - Vars:
17:07:18.645 - BUN_VERSION: "1.2.0"
17:07:18.645 - PUBLIC_GCLOUD_PROJECT_ID: "8381521..."
17:07:18.645 - PUBLIC_BRIGHT_DATA_USERNAME: "brd-customer-hl_9774..."
17:07:18.645 - PUBLIC_BRIGHT_DATA_HOST: "brd.superproxy..."
17:07:18.645 - PUBLIC_BRIGHT_DATA_PORT: "22225"
17:07:18.645 - PUBLIC_SUPABASE_URL: "http://127.0.0.1:54321"
17:07:18.645 - PUBLIC_SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIs..."
17:07:18.646 Uploaded post-crawl-workers (1.99 sec)
17:07:19.061 Deployed post-crawl-workers triggers (0.21 sec)
17:07:19.061 https://post-crawl-workers.ideaape.workers.dev
17:07:19.061 Current Version ID: ae290133-cc38-4b8c-983e-4792b6a4b5db
17:07:18.645 - ratelimit: ACCOUNT_TIER_ONE
17:07:18.645 - ratelimit: ACCOUNT_TIER_TWO
17:07:18.645 - Vars:
17:07:18.645 - BUN_VERSION: "1.2.0"
17:07:18.645 - PUBLIC_GCLOUD_PROJECT_ID: "8381521..."
17:07:18.645 - PUBLIC_BRIGHT_DATA_USERNAME: "brd-customer-hl_9774..."
17:07:18.645 - PUBLIC_BRIGHT_DATA_HOST: "brd.superproxy..."
17:07:18.645 - PUBLIC_BRIGHT_DATA_PORT: "22225"
17:07:18.645 - PUBLIC_SUPABASE_URL: "http://127.0.0.1:54321"
17:07:18.645 - PUBLIC_SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIs..."
17:07:18.646 Uploaded post-crawl-workers (1.99 sec)
17:07:19.061 Deployed post-crawl-workers triggers (0.21 sec)
17:07:19.061 https://post-crawl-workers.ideaape.workers.dev
17:07:19.061 Current Version ID: ae290133-cc38-4b8c-983e-4792b6a4b5db
in my nextjs workers app [env.production.vars] overrode the standard vars as expected. Does it not work this way for standard workers? I'm abit confused as how I should structure these.
BL22
BL225d ago
Traduz
Kenny
KennyOP5d ago
Traduz?
BL22
BL225d ago
@BL22
Kenny
KennyOP5d ago
Idk what that means When I remove the envs from the main var it still doesn't show which proves that it's not even noticing that it's in the prodution environment i'm not sure how I can make it notice this
BL22
BL225d ago
When I remove the envs from the main var it still doesn't show which proves that it's not even noticing that it's in the prodution environment

Did you find this page helpful?