Skip to content

Providing a request body when the response is 401 fails #4910

@beanow-at-crabnebula

Description

@beanow-at-crabnebula

Bug Description

What seems to be from a change in #4747

Any (non websocket) request that includes a request body and gets a 401 response errors.

    TypeError: fetch failed

      at Object.processResponse (node_modules/.pnpm/wrangler@4.75.0/node_modules/wrangler/wrangler-dist/cli.js:31323:21)
      at node_modules/.pnpm/wrangler@4.75.0/node_modules/wrangler/wrangler-dist/cli.js:31709:23

    Cause:
    expected non-null body source

      at makeNetworkError (node_modules/.pnpm/wrangler@4.75.0/node_modules/wrangler/wrangler-dist/cli.js:30097:36)
      at httpNetworkOrCacheFetch (node_modules/.pnpm/wrangler@4.75.0/node_modules/wrangler/wrangler-dist/cli.js:31924:20)
      at httpFetch (node_modules/.pnpm/wrangler@4.75.0/node_modules/wrangler/wrangler-dist/cli.js:31733:37)
      at mainFetch (node_modules/.pnpm/wrangler@4.75.0/node_modules/wrangler/wrangler-dist/cli.js:31495:24)

Reproducible By

https://github.com/beanow-at-crabnebula/undici-401-request-body

Additional context

The reproduction there uses Cloudflare worker's wrangler.
Which bundles undici@7.24.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions