TypeError: self.client.sendRequest is not a function
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 768
- Forks
- 191
- PR merge metrics
- No merged PRs in 30d
Description
This error appears went trying to make a geocode call:
TypeError: self.client.sendRequest is not a function
at MapiRequest.send (mapi-request.js:160:1)
at MapboxApi (mapbox-api.tsx:15:1)
at renderWithHooks (react-dom.development.js:16141:1)
at mountIndeterminateComponent (react-dom.development.js:20838:1)
at beginWork (react-dom.development.js:22342:1)
at beginWork$1 (react-dom.development.js:27219:1)
at performUnitOfWork (react-dom.development.js:26395:1)
at workLoopSync (react-dom.development.js:26303:1)
at renderRootSync (react-dom.development.js:26271:1)
at performSyncWorkOnRoot (react-dom.development.js:25924:1)

this is the code:
import mbxClient from "@mapbox/mapbox-sdk/lib/classes/mapi-client"
import mbxGeocoding from "@mapbox/mapbox-sdk/services/geocoding"
const baseClient = new mbxClient({
accessToken:
"pk.eyJ1IjoiYWlybWF0cml4NjQ3IiwiYSI6ImNqeG5wZXNlajBoMGUzbm82ZjcweWF0OHkifQ.4iv7e_Bep3UXFbhp7nUqHQ",
})
const geocodingClient = mbxGeocoding(baseClient)
export interface MapboxApiProps {}
export function MapboxApi(props: MapboxApiProps) {
geocodingClient
.forwardGeocode({
query: "Paris, France",
limit: 2,
})
.send()
.then((response) => {
const match = response.body
console.log(match)
})
return (
Welcome to MapboxApi!
)
}
export default MapboxApi
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 by reproducing the geocode call in the provided MapboxApi component and inspect mapi-request.js at line 160, then compare it with client construction in mapbox-api.tsx. Check the SDK's request and geocoding entry points to establish the expected client shape. Done means the forward geocode request completes without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react, typescript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100