How to source process.env in monorepo in a worker?
I have a simple email worker. My registry imported from another package is erroring by not finding the env vars that are being parsed
I am running the script in package.json
"dev:email": "dotenv -e ../../.env -- bun run wrangler dev -c src/cloudflare/email/wrangler.jsonc",
"dev:email": "dotenv -e ../../.env -- bun run wrangler dev -c src/cloudflare/email/wrangler.jsonc",
I can confirm that dotenv is picking up the env file
[wrangler:inf] Ready on http://localhost:8787✘ [ERROR] service core:user:email-service: Uncaught Error: TraversalError: • OPENAI_API_KEY must be a string (was missing) • OPENROUTER_API_KEY must be a string (was missing) at null.<anonymous> (index.js:11262:12) in toTraversalError at null.<anonymous> (index.js:11255:16) in throw at null.<anonymous> (index.js:11687:108) at null.<anonymous> (index.js:11470:23) in finalize at null.<anonymous> (index.js:11644:22)
[wrangler:inf] Ready on http://localhost:8787✘ [ERROR] service core:user:email-service: Uncaught Error: TraversalError: • OPENAI_API_KEY must be a string (was missing) • OPENROUTER_API_KEY must be a string (was missing) at null.<anonymous> (index.js:11262:12) in toTraversalError at null.<anonymous> (index.js:11255:16) in throw at null.<anonymous> (index.js:11687:108) at null.<anonymous> (index.js:11470:23) in finalize at null.<anonymous> (index.js:11644:22)