mapbox / mapbox/mapbox-maps-flutter
Offline map downloads fail with HTTP 429 error
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
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/](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**
1. 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).
2. The API should allow download threads and timeouts to be configured.
3. 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)
);
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the offline map example linked in the issue and trace TileStore and loadTileRegion behavior in mapbox_maps_flutter. Reproduce an HTTP 429 response and follow how progress and errors cross into Flutter. Done means rate-limit failures are surfaced promptly and the offline download no longer appears indefinitely frozen, with the requested backoff or configuration behavior clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100