Skip to content

[wrangler] Print temporary account notices to stderr - #16068

Merged
edevil merged 1 commit into
mainfrom
acruz/temporary-status-stderr
Oct 5, 2026
Merged

edevil merged 1 commit into
mainfrom
acruz/temporary-status-stderr

Conversation

@edevil

@edevil edevil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

With --temporary, three messages were logged to stdout through the injected logger: the terms notice (non-interactive mode), "Solving proof-of-work challenge…", and the "Temporary account ready" block with the claim URL. The last one is printed on every run, including when a cached account is reused. As a result:

  • Output that commands write to stdout for parsing was corrupted. For example, kv namespace list --temporary no longer printed valid JSON, and kv key get --temporary put the banner in front of the value. Once [wrangler] Support temporary event accounts in R2 and Containers commands #16036 lands, the same would apply to r2 object get --pipe and the --json modes of R2 and Containers commands.
  • Commands that lower the log level to "error" for --json, such as d1 execute --json, dropped the banner entirely, so the participant never saw the claim URL.

This PR:

  • workers-auth: adds an optional AuthContext.temporaryAccountLogger (type TemporaryAccountLogger = Pick<Logger, "log">). It receives the three temporary-account messages, is passed into the flow's temporary context for the proof-of-work message, and defaults to logger. The cf CLI's behavior is unchanged. OAuthFlowTemporaryContext.prompt's doc already said the notice belongs on stderr.

  • wrangler: passes temporaryAccountLogger: { log: (...args) => logger.console("error", ...args) }. This writes the text unformatted (no ▲ [WARNING]), stays visible when a command sets the level to "error", still respects --log-level none, and runs the logger's spinner hooks. These messages are no longer written to the debug log file, which also keeps the claim token out of it.

  • d1 execute: --json raised the log level to "error" even when it was "none". Status messages are logged at the "error" level, so this would have printed the claim details despite WRANGLER_LOG=none. It now keeps "none".

Behavior change: scripts that read the claim URL from stdout now need stderr (2>&1). This is called out in the changeset.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: --temporary is a hidden flag; the output stream change is described in the changeset.

@changeset-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a2c88ae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
wrangler Patch
@cloudflare/workers-auth Minor
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch
@cloudflare/remote-bindings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team October 5, 2026 16:21
@workers-devprod

workers-devprod commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/d1
  • ✅ @cloudflare/wrangler
Show detailed file reviewers
  • packages/wrangler/src/tests/d1/migrate.test.ts: [@cloudflare/d1]
  • packages/wrangler/src/d1/execute.ts: [@cloudflare/d1]

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ask-bonk

ask-bonk Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16068

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16068

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16068

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16068

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16068

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16068

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16068

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16068

miniflare

npm i https://pkg.pr.new/miniflare@16068

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16068

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16068

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16068

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16068

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16068

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16068

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16068

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16068

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16068

wrangler

npm i https://pkg.pr.new/wrangler@16068

commit: a2c88ae

@edevil
edevil force-pushed the acruz/temporary-status-stderr branch 2 times, most recently from e4e6f91 to d2f9d0c Compare October 5, 2026 16:46

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @edevil 🙏

I find that renaming the statusLogger to logger during the flow makes the whole thing really difficult to read, could we keep a consistent name for the variable?

statusLogger also seems unnecessarily unclear to me, what about stdErrLogger or warnLevelLogger or something to this extend to more clearly show what it's doing? (this applies to the type as well of course)

@dario-piotrowicz

Copy link
Copy Markdown
Member

Thanks for the PR @edevil 🙏

I find that renaming the statusLogger to logger during the flow makes the whole thing really difficult to read, could we keep a consistent name for the variable?

statusLogger also seems unnecessarily unclear to me, what about stdErrLogger or warnLevelLogger or something to this extend to more clearly show what it's doing? (this applies to the type as well of course)

Also additionally, I do wonder if it's better to convert the log to be in a warn level or on a debug one, like in: #16029

I think both approaches have their own merits. But in particular I think that the debug one is pretty nice in the fact that the terminal text actually presented to the user is all json parsable, so the user can, if they want actually copy-paste the JSON-parsable text. 🤔

The terms notice, proof-of-work message and "Temporary account ready"
claim details were logged to stdout, corrupting JSON and raw values that
commands write there, and disappearing when --json commands lowered the
log level. Add a temporaryAccountLogger option to workers-auth for these
notices and route it to stderr in Wrangler.

Keep WRANGLER_LOG=none in d1 execute --json, which previously raised it
to "error" and would now let the claim details through.
@edevil
edevil force-pushed the acruz/temporary-status-stderr branch from d2f9d0c to a2c88ae Compare October 5, 2026 18:14
@edevil

edevil commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @dario-piotrowicz . I've renamed it to temporaryAccountLogger, since that's what it's used for. The destination depends on what is passed in, if anything.

On debug vs stderr, these messages cannot be hidden, the claim URL is the only way someone can claim the account, and we need to show the ToS, so I have to leave them in stderr.

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners Bypass

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@edevil
edevil enabled auto-merge (squash) October 5, 2026 18:21
@edevil
edevil merged commit 26e03e2 into main Oct 5, 2026
59 of 61 checks passed
@edevil
edevil deleted the acruz/temporary-status-stderr branch October 5, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants