Skip to content

Revision 1 — the current text. The evidence on this page is this revision’s own — it has not been carried forward from, or to, any other revision.

Fixing wrangler d1 execute --remote hanging with no output

Covers the interactive-confirmation-prompt cause (the most common one, especially in CI or piped/backgrounded shells) and network connectivity to the Cloudflare API as a secondary cause. Does not cover a command that's genuinely still running against a very large file — check for real progress (network/CPU activity) before assuming it's stuck.

Unverifiedno reproductions yetWhy this confidence?
Revision 1published by DevYou curation

Symptoms

The diagnostic path

8 steps, exactly as this revision published them.

  1. Step 1 · Startwrangler d1 execute --remote hangs with no output

    The command starts and never finishes — no error, no result, no progress output.

    What happens next

    • passed step 2, Check whether it's waiting on a confirmation prompt
  2. Step 2 · TestCheck whether it's waiting on a confirmation prompt

    Several wrangler d1 operations against the remote database print a confirmation prompt before running. If stdin isn't an interactive TTY — a CI job, a script, a piped command, a backgrounded process — that prompt can never be answered and the process just sits there indefinitely.

    Read-onlysh
    npx wrangler d1 execute <DATABASE_NAME> --remote --file=./schema.sql

    Expected result

    A line similar to "About to run the following queries on the remote database ... Ok to proceed? (y/N)" appears and waits for a keypress, when run directly in an interactive terminal.

    What happens next

    • passed step 3, Pass --yes to skip the confirmation prompt
    • failed step 4, Check network connectivity to the Cloudflare API
    • unknown step 3, Pass --yes to skip the confirmation prompt
  3. Step 3 · FixPass --yes to skip the confirmation prompt

    Add --yes (or -y) so wrangler runs without waiting for interactive confirmation — required for CI, scripts, and any non-interactive invocation.

    Changes statesh

    Changes system or service state. Review before running.

    Skips wrangler's interactive confirmation and runs the given queries directly against the remote D1 database. There is no prompt to catch a mistake, so double-check the file or command before adding --yes, especially for destructive SQL.

    npx wrangler d1 execute <DATABASE_NAME> --remote --file=./schema.sql --yes

    What happens next

    • passed step 5, Re-run the original command
  4. Step 4 · TestCheck network connectivity to the Cloudflare API

    If the prompt genuinely isn't the cause (it hangs even run interactively), a corporate proxy, VPN, or firewall silently dropping the HTTPS connection to Cloudflare's API produces the same no-output hang.

    Read-onlysh
    curl -v https://api.cloudflare.com/client/v4/user/tokens/verify -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"

    Expected result

    The curl request itself hangs or times out, rather than returning a JSON response (success or auth error).

    What happens next

    • passed step 6, Fix the network path to Cloudflare's API
    • failed step 7, Not a prompt or network issue — escalate
    • unknown step 7, Not a prompt or network issue — escalate
  5. Step 5 · Verify the fixRe-run the original command

    Run the same command that previously hung and confirm it completes.

    Changes statesh

    Changes system or service state. Review before running.

    Executes the file's SQL statements against the remote D1 database.

    npx wrangler d1 execute <DATABASE_NAME> --remote --file=./schema.sql --yes

    Expected result

    A result summary (rows affected, or query output) prints and the command returns.

    What happens next

    • passed step 8, Resolved
    • failed step 7, Not a prompt or network issue — escalate
    • unknown step 7, Not a prompt or network issue — escalate
  6. Step 6 · FixFix the network path to Cloudflare's API

    Configure the proxy environment variables wrangler needs (e.g. HTTPS_PROXY), or run from a network/CI runner that isn't blocking outbound HTTPS to api.cloudflare.com.

    What happens next

    • passed step 5, Re-run the original command
  7. Step 7 · EndNot a prompt or network issue — escalate

    Check whether the file being executed is unusually large. wrangler batches statements from a large --file and can look hung while genuinely still working — check for ongoing CPU/network activity on the process before concluding it's stuck, and consider splitting a very large file into smaller batches.

  8. Step 8 · EndResolved

    The command now completes instead of hanging.

Sources

Why this confidence?

What would strengthen it: 6 more independent reproductions. Reproductions from 3 more distinct environments.

This counts only what was recorded against revision 1 itself. Nothing reported against another revision is included here — see the revision history for why.