nchaulet / node-geocoder

nodejs geocoding library
http://nchaulet.github.io/node-geocoder/
MIT License
924 stars 213 forks source link

OpenStreetMap // Node Error Body used already #357

Open LBeckX opened 1 month ago

LBeckX commented 1 month ago

Hi, I am currently getting the following error with OpenStreetMap.

HttpError: body used already for: https://nominatim.openstreetmap.org/search?accept-language=de-DE&addressdetails=1&q=Erlanger Straße+91080+Deutschland&format=json

This is my implementation that worked before.


async function getGeoLocationAddresses(address: string) {
        const geocoder = NodeGeoCoder({provider: 'openstreetmap', email: 'test@test.de', language: 'de-DE'})
        const response = await geocoder.geocode(address + ' Deutschland')
        if (!response[0]) {
            throw new Error(`Can not get geolocation - response is empty by address: ${address}`)
        }
        return response
}
SultanGabriel commented 1 month ago

same here

loique commented 1 month ago

same here

SultanGabriel commented 1 month ago

Been able to temporarly fix the issue by applying the changes from PR #346. What happens is that there is a bug in the error handling code which leads to an error and the actual error is not being logged.

victordalet commented 4 weeks ago

Same here, but we can still request the API

const response = await fetch(`https://nominatim.openstreetmap.org/search?addressdetails=1&q=${location.address.replace(" ", "+")}&format=json`)
const data = await response.json();
farrukh-educative commented 2 weeks ago

The same issue is being faced here. Do we have any update if the issue is fixed or when can it be fixed? Thanks.

SultanGabriel commented 2 weeks ago

The same issue is being faced here. Do we have any update if the issue is fixed or when can it be fixed? Thanks.

A fix already should exist for the bug PR #346. I haven't looked again if the PR got merged but you could copy the commit for a temporary fix, it's 4 or 5 lines that need changing

isntfunny commented 1 week ago

Could you release the new version? The PR got merged 2 weeks ago already