mapbox / mapbox-sdk-js

A JavaScript client to Mapbox services, supporting Node, browsers, and React Native
Other
719 stars 186 forks source link

Bug(regression) - Socket hang up since v0.13.5 #459

Closed MatejSkrbis closed 8 months ago

MatejSkrbis commented 2 years ago

Last working version is 0.13.4 Since then versions 0.13.5+ are broken.

When deleting tilesets, tileset sources or styles, socket may hang up (probably with larger ones). Previous version normally deletes sources that cannot be deleted with v0.13.5+ (even after trying for many times)

Code example:

const mbxTilesets = require('@mapbox/mapbox-sdk/services/tilesets');
const tilesetsService = mbxTilesets(baseClient);

...

    await tilesetsService.deleteTileset({
        tilesetId: 'myuser.tilesetId'
    }).send();

...

Error:


RequestError: socket hang up
    at ClientRequest.<anonymous> (mypath\Mapbox\node_modules\got\dist\source\core\index.js:970:111)
    at Object.onceWrapper (node:events:642:26)
    at ClientRequest.emit (node:events:539:35)
    at ClientRequest.origin.emit (mypath\Mapbox\node_modules\@szmarczak\http-timer\dist\source\index.js:43:20)
    at TLSSocket.socketOnEnd (node:_http_client:478:9)
    at TLSSocket.emit (node:events:539:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at connResetException (node:internal/errors:692:14)
    at TLSSocket.socketOnEnd (node:_http_client:478:23)
    at TLSSocket.emit (node:events:539:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ECONNRESET',
  timings: {
    start: 1667981491934,
    socket: 1667981491935,
    lookup: 1667981491935,
    connect: 1667981491944,
    secureConnect: 1667981491951,
    upload: undefined,
    response: undefined,
    end: undefined,
    error: 1667981521950,
    abort: undefined,
    phases: {
      wait: 1,
      dns: 0,
      tcp: 9,
      tls: 7,
      request: undefined,
      firstByte: undefined,
      download: undefined,
      total: 30016
    }
  }
}
mapsam commented 8 months ago

Thanks @MatejSkrbis! This was fixed in #479 and released as @mapbox/mapbox-sdk@0.15.4