mykiwi/mykiwi.blogpublic Fork
⑂ 73f7684
Commits
⬇ Clone ▾
git clone https://git.rickub.com/mykiwi/mykiwi.blog.git
git clone ssh://git@rickub.com/mykiwi/mykiwi.blog.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Pass the Cloudflare account id to wrangler pages deploy explicitly

Pages only honours a discovered wrangler.toml when it declares
pages_build_output_dir, which ours can't: the directory differs per
language (result/en, result/fr, ...) and is passed positionally. So
the account_id in wrangler.toml was read by nobody, and Wrangler fell
back to asking the API which accounts the token can see. An
account-scoped token lists none - the call succeeds and returns [] -
and the deploy died on "Failed to automatically retrieve account
IDs", which reads like an expired token but isn't.

Source the id from wrangler.toml so it stays the one place it is
written down.
Romain Gautier committed 2026-09-20T12:50:12+02:00 Browse files
73f7684 parent: 4f2eb81
modified flake.nix +13 -1
@@ -87,7 +87,7 @@
8787 type = "app";
8888 program = "${pkgs.writeShellApplication {
8989 name = "mykiwi-blog-deploy";
90- runtimeInputs = [ wrangler pkgs.git ];
90+ runtimeInputs = [ wrangler pkgs.git pkgs.gnused ];
9191 text = ''
9292 lang="''${1:?usage: nix run .#deploy -- <lang>}"
9393 root="$(git rev-parse --show-toplevel)"
@@ -97,6 +97,18 @@
9797 # configuration file"), so cd to where wrangler.toml lives and
9898 # let Wrangler auto-discover it instead.
9999 cd "$root"
100+ # ...except Pages only *honours* a discovered wrangler.toml when it
101+ # declares pages_build_output_dir, which ours can't: the directory
102+ # differs per language (result/en, result/fr, ...) and is passed
103+ # positionally below. So the account_id in wrangler.toml is read by
104+ # nobody, and Wrangler falls back to asking the API which accounts
105+ # the token can see. An account-scoped token lists none - the call
106+ # succeeds and returns [] - and the deploy dies on "Failed to
107+ # automatically retrieve account IDs", which reads like an expired
108+ # token but isn't. Pass the id explicitly, still sourced from
109+ # wrangler.toml so it stays the one place it's written down.
110+ CLOUDFLARE_ACCOUNT_ID="$(sed -n 's/^account_id *= *"\(.*\)"/\1/p' "$root/wrangler.toml")"
111+ export CLOUDFLARE_ACCOUNT_ID
100112 wrangler pages deploy "$root/result/$lang" --project-name="$project" --branch=main
101113 '';
102114 }}/bin/mykiwi-blog-deploy";
@@ -87,7 +87,7 @@
87 type = "app";87 type = "app";
88 program = "${pkgs.writeShellApplication {88 program = "${pkgs.writeShellApplication {
89 name = "mykiwi-blog-deploy";89 name = "mykiwi-blog-deploy";
90- runtimeInputs = [ wrangler pkgs.git ];90+ runtimeInputs = [ wrangler pkgs.git pkgs.gnused ];
91 text = ''91 text = ''
92 lang="''${1:?usage: nix run .#deploy -- <lang>}"92 lang="''${1:?usage: nix run .#deploy -- <lang>}"
93 root="$(git rev-parse --show-toplevel)"93 root="$(git rev-parse --show-toplevel)"
@@ -97,6 +97,18 @@
97 # configuration file"), so cd to where wrangler.toml lives and97 # configuration file"), so cd to where wrangler.toml lives and
98 # let Wrangler auto-discover it instead.98 # let Wrangler auto-discover it instead.
99 cd "$root"99 cd "$root"
100+ # ...except Pages only *honours* a discovered wrangler.toml when it
101+ # declares pages_build_output_dir, which ours can't: the directory
102+ # differs per language (result/en, result/fr, ...) and is passed
103+ # positionally below. So the account_id in wrangler.toml is read by
104+ # nobody, and Wrangler falls back to asking the API which accounts
105+ # the token can see. An account-scoped token lists none - the call
106+ # succeeds and returns [] - and the deploy dies on "Failed to
107+ # automatically retrieve account IDs", which reads like an expired
108+ # token but isn't. Pass the id explicitly, still sourced from
109+ # wrangler.toml so it stays the one place it's written down.
110+ CLOUDFLARE_ACCOUNT_ID="$(sed -n 's/^account_id *= *"\(.*\)"/\1/p' "$root/wrangler.toml")"
111+ export CLOUDFLARE_ACCOUNT_ID
100 wrangler pages deploy "$root/result/$lang" --project-name="$project" --branch=main112 wrangler pages deploy "$root/result/$lang" --project-name="$project" --branch=main
101 '';113 '';
102 }}/bin/mykiwi-blog-deploy";114 }}/bin/mykiwi-blog-deploy";