Offline map downloads fail with HTTP 429 error
The Mapbox Flutter SDK makes too many requests on the Mapbox tile server.
When a 429 response is returned from the server, it is logged to the console but not exposed to Flutter, resulting in the Flutter code "freezing" and waiting for the next progress callback.
Following the instructions given here to add offline map tiles results in the problem: https://docs.mapbox.com/flutter/maps/examples/offline/
Solutions tried: There is an error count property on the progress event object, but this is not updated. There are no error handler callback functions available on the loadTileRegion method, and no exceptions are thrown to indicate a problem.
** Version affected ** I'm using mapbox_maps_flutter: ^2.9.0 (offline maps was added in 2.1.0, and there's nothing in the changelog to indicate any changes have been made to tile stores since 2.3.0).
This is affecting our production app We added this feature to our app many moths ago but have recently been getting reports from users that the feature is broken.
Expected bahaviour
- The TileStore API should impose less drastic backoff times (60 seconds is too long, especially when imposed frequently, and users think the app has hung - one user reported that a download was left open for an hour and did not complete).
- The API should allow download threads and timeouts to be configured.
- Errors should be reported to Flutter immediately so feedback can be displayed to users.
Chat GPT suggetsed this:
final tileStore = TileStore.create();
await tileStore.setOption(
TileStoreOptions.HTTP_MAX_REQUEST_COUNT_PER_HOST,
2 // Reduce from default (usually 8-16)
);
Is anyone looking into this? We're getting lots of error reports from our users and there's nothing we can do to fix the problem.