mapbox / mapbox/mapbox-sdk-js

"exclude must be a string." error using mbxDirections in mapbox-sdk-js 13.3

Open
#446 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
768
Forks
191
PR merge metrics
No merged PRs in 30d

Description

Our team has been using `mbxDirections` to calculate road distance using Mapbox for ~2 months with the following configs.
```
await directionsService
.getDirections({
profile: 'driving',
waypoints: stops.map((s) => ({
coordinates: [s.longitude, s.latitude],
})) as DirectionsWaypoint[],
geometries: 'polyline',
overview: 'full',
steps: true,
exclude: ['ferry'],
})
.send();
```

However, our API stopped working and started seeing `Error: exclude must be a string.` since 7/12/22.
I tried updating to the latest (13.4) of the sdk, and the same issue still remains.
I tried removing the sdk and instead querying the endpoint directly with the following CURL and it works
```
curl --location --request GET 'https://api.mapbox.com/directions/v5/mapbox/driving/-122.393806%2C37.786041%3B-122.401527%2C37.788712?geometries=polyline&overview=full&steps=true&exclude=ferry&access_token=
```

I would like to confirm with mapbox that this is due to an API change that isn't being reflected in the sdk client. Thank you!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the mbxDirections directionsService.getDirections(...).send() request path and inspect how the exclude option is serialized. Compare the SDK request with the working curl example, then verify that the resulting request accepts the documented ferry exclusion and add or run coverage for this configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.