workers-sdk
workers-sdk copied to clipboard
🐛 BUG: [3.80.4] Multi-account-project .env configuration no longer works with independent CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN
Which Cloudflare product(s) does this pertain to?
Wrangler, workers
What version(s) of the tool(s) are you using?
3.80.4
What version of Node are you using?
20.9.0
What operating system and version are you using?
Windows 11 with VSCode
Describe the Bug
Description: In the previous versions of Wrangler, I was able to use independent .env files with project-specific CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN configurations across multiple projects. This setup allowed me to deploy each project independently using its respective tokens without issues.
However, since the latest updates (currently using Wrangler v3.80.4), this configuration no longer works as expected. Now, every time I run pnpm wrangler deploy, I receive the following error:
cd account_1_ulit-auth
pnpm wrangler deploy
X [ERROR] You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log in via OAuth.
X [ERROR] Did not login, quitting...
cd account_2_paypal_callback
pnpm wrangler deploy
X [ERROR] You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log in via OAuth.
X [ERROR] Did not login, quitting...
This message indicates that OAuth login is required instead of using the project-specific API token, which is not feasible for multi-account setups where each project requires unique credentials.
Expected Behavior
The command pnpm wrangler deploy should:
- Recognize the
.envfile in each project directory, allowing independent API tokens for each project. - Continue supporting
CLOUDFLARE_ACCOUNT_IDandCLOUDFLARE_API_TOKENfrom the.envfile without requiring OAuth login, as in previous versions.
Actual Behavior
Wrangler now ignores the .env configuration for independent projects with unique tokens and prompts to use OAuth login.
Steps to Reproduce
- Set up multiple projects, each with its own
.envfile containing uniqueCLOUDFLARE_ACCOUNT_IDandCLOUDFLARE_API_TOKEN. - Run
pnpm wrangler deployin each project. - Observe the error regarding OAuth login.
Environment
- Wrangler version: v3.80.4
- Node version: v20.9.0
- pnpm version: 9.12.1
- OS: Windows 11 with VSCode
Additional Context
This change significantly impacts workflows that rely on project-specific credentials, complicating the management of multiple Cloudflare accounts with unique tokens.
Is there any plan to restore .env support for independent API tokens, or a workaround that doesn’t rely on OAuth login for each project?
Please provide a link to a minimal reproduction
No response
Please provide any relevant error logs
No response