cloudflare/workers-sdk

๐Ÿ› BUG: Build Requests `account_id` in Wrangler.toml but fails with `account_id`

Opened this issue ยท 3 comments

Which Cloudflare product(s) does this pertain to?

Workers Runtime

What version(s) of the tool(s) are you using?

3.70.0 [wrangler]

What version of Node are you using?

No response

What operating system and version are you using?

Cloudflare Dashboard

Describe the Bug

https://dash.cloudflare.com/ab7347813b21ea6079df4cb18c4bb9e8/pages/view/exchange-traded-fund/952e6991-3192-47dd-9121-12b7bbce5d01

00:30:22.332    โœ˜ [ERROR] More than one account available but unable to select one in non-interactive mode.
00:30:22.332    
00:30:22.332      Please set the appropriate `account_id` in your `wrangler.toml` file.
00:30:22.332      Available accounts are (`<name>`: `<account_id>`):

https://dash.cloudflare.com/ab7347813b21ea6079df4cb18c4bb9e8/pages/view/exchange-traded-fund/caf73d0b-3b79-4c19-9ce6-e83e33dac0f4

00:31:50.811    Found wrangler.toml file. Reading build configuration...
00:31:50.825    
00:31:50.930    โœ˜ [ERROR] Running configuration file validation for Pages:
00:31:50.930    
00:31:50.931        - Configuration file for Pages projects does not support "account_id"

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

I think this could be solved if the Pages build infrastructure simply provided the CLOUDFLARE_ACCOUNT_ID environment variable when running the Wrangler commands. I believe that the account is already known at this point and so could be made available.
Allowing the wrangler.toml to specify the account_id could create potential for a source of truth conflict where the Pages infrastructure is running within one account but then Wrangler is trying to deploy to another account.

@petebacondarwin it does fix it by adding the CLOUDFLARE_ACCOUNT_ID as an environment variable.
I'm just following the directions as per the console error suggestions. And yes I think it should know already what account is in it.

Yeah the error message is the most unfortunate piece here but I do think that Pages CI can just do this for us and avoid the user having to do anything.