Custom Domain for production env not working

I have a domain managed by CF fully. I have a local wrangler.toml that defines two environments, stage and production, like this:
compatibility_date = "2023-01-01"
main = "src/index.ts"

# Dev server
[dev]
port = 3535

# Local Dev
[env.dev]
name = "api-dev"
workers_dev = false
vars = { ENVIRONMENT = "dev" }
d1_databases = [
    { binding = "DB-DEV", database_id = "xxx" },
]

# Stage 
[env.stage]
name = "api-stage"
workers_dev = true # deploy to *.workers.dev
vars = { ENVIRONMENT = "stage" }
routes = [{ pattern = "api.stage.example.com", custom_domain = true }]
d1_databases = [
    { binding = "DB-STAGE", database_id = "xxx" },
]

# Production

[env.production]
name = "api-production"
workers_dev = false
vars = { ENVIRONMENT = "production" }
routes = [{ pattern = "api.example.com", custom_domain = true }]
d1_databases = [
    { binding = "DB-PROD", database_id = "xxx" },
]


I deploy staging with:
wrangler deploy -e stage
And everything works. I can access my worker on api.stage.example.com

I deploy production similarly:
wrangler deploy -e production
But cannot access the worker in any way. DNS just doesn't resolve

Note, in the second screenshot, it shows the workers.dev domain
api-production.REDACTED.workers.dev
as disabled. This is how wrangler deploy creates it. If I enable it, then I can access it on that domain (workers.dev), but still not on my own domain.
image.png
image.png
Was this page helpful?