Secrets undefined errors (solved)

Wrangler publish throws this error:
Error: Something went wrong with the request to Cloudflare…
Uncaught ReferenceError: OAUTH0SECRET is not defined
That secret is defined, and wrangler dev throws another error for some reason. I don’t about wrangler dev, but I thought it may be pertinent:

 Using namespace for Workers Site "__test-worker-workers_sites_assets_preview"
Error: Something went wrong with the request to Cloudflare...
Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.
  at line 3846 in onerror
  at line 4194
  at line 4200
 [API code: 10021]

Heres the toml file with all ids erased.

name = "test-worker"
type = 'javascript'
account_id = ''
workers_dev = true
compatibility_date = "2021-09-17"
kv_namespaces = [ 
  { binding = "kv",id = "", preview_id = "" }
MODE = 'test'
MODE = 'production'

bucket = './public'
entry-point = "."
command = "npm run build"
# The "modules" upload format is required for all projects that export a Durable Objects class
format = "service-worker"

name = "email-production"
kv_namespaces = [ 
  { binding = "kv", id = "" }
zone_id = ''

Two things happened. I probably didn’t use the env flag when putting secrets. I didn’t create a service/worker on cloudflare worker dashboard that matched the name of production environment as per (Unable to set secrets on a new environment, which causes publish to fail · Issue #1129 · cloudflare/wrangler · GitHub)