Skip to content

fetch seems to error on 301 response #11

@Gozala

Description

@Gozala
fetch(url, { method: 'POST', headers })
Promise { <pending> }
> f(node:66034) UnhandledPromiseRejectionWarning: FetchError: request to ... failed, reason: connect ENETUNREACH ...:443
    at ClientRequest.<anonymous> (file:///Users/gozala/Projects/nft.storage/node_modules/@web-std/fetch/src/index.js:100:11)
    at ClientRequest.emit (events.js:315:20)
    at ClientRequest.EventEmitter.emit (domain.js:467:12)
    at TLSSocket.socketErrorListener (_http_client.js:469:9)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(node:66034) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)

Promise {
  <rejected> FetchError: request to ... failed, reason: connect ENETUNREACH ....:443
      at ClientRequest.<anonymous> (file:///Users/gozala/Projects/nft.storage/node_modules/@web-std/fetch/src/index.js:100:11)
      at ClientRequest.emit (events.js:315:20)
      at ClientRequest.EventEmitter.emit (domain.js:467:12)
      at TLSSocket.socketErrorListener (_http_client.js:469:9)
      at TLSSocket.emit (events.js:315:20)
      at TLSSocket.EventEmitter.emit (domain.js:467:12)
      at emitErrorNT (internal/streams/destroy.js:106:8)
      at emitErrorCloseNT (internal/streams/destroy.js:74:3)
      at processTicksAndRejections (internal/process/task_queues.js:80:21) {
    type: 'system',
    errno: 'ENETUNREACH',
    code: 'ENETUNREACH',
    erroredSysCall: 'connect'
  }
}

Instead request should follow a redirect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions