mapbox/mapbox-sdk-js

'InternalServerError' on specific IDs of createTilesetSource request

evanfurbeyre opened this issue · 1 comments

Certain tileset-source-ids behave as expected, where after 10 uploads of the same tileset-source-id you have to delete the tileset-source and can then go on using that same id. However, after some period of time (weeks) it becomes impossible to use an ID and you get a 500 Internal Server Error.

In the following code sample choosing a fresh id will behave as expected, but switching the id variable to one of the 3 or 4 we have already cycled through will throw Internal Server Errors.

Not sure how to recreate without giving access to our account with some tokens.

var mbxClient = require('@mapbox/mapbox-sdk');
var mbxTilesets = require('@mapbox/mapbox-sdk/services/tilesets');

const baseClient = mbxClient({
  accessToken: '...'
});
const tilesetsClient = mbxTilesets(baseClient);

(async function main() {
  const id = 'v1_fire_geom_prod';
  for (let i = 1; i <= 20; i++) {
    try {
      await tilesetsClient
        .createTilesetSource({ id, file: __dirname + '/fireGeom.json' })
        .send();
      console.log('Success', i);
    } catch (e) {
      console.error('Error:', e.message);
      const tilesetExists = tilesetsClient
        .listTilesetSources()
        .send()
        .then((res) => res.body.find((s) => s.id.includes(id)));
      if (tilesetExists) {
        await tilesetsClient.deleteTilesetSource({ id }).send();
        await tilesetsClient
          .createTilesetSource({ id, file: __dirname + '/fireGeom.json' })
          .send()
          .then(() => {
            console.log('deleted and recreated tileset source - no error');
          });
      }
    }
  }
})();

hi @evanfurbeyre issues relating to the API itself are best reported directly to Mapbox Support.

Because this is not something we can action in the SDK, I'll close this one.