tsamaya / opencage-api-client

OpenCage Data geocoder API client
https://tsamaya.github.io/opencage-api-client/
MIT License
18 stars 12 forks source link

error with fetch #303

Open xStranged1 opened 2 weeks ago

xStranged1 commented 2 weeks ago

idk why, in my expo react native app "expo": "~51.0.28", this library breaks fetch

try { const res = await fetch(API_URL + '/auth/login', options); if (res.status == 200) { // do something } return { errorHttp: res.status } } catch (error) { console.log(error) // LOG [TypeError: fetch is not a function (it is false)] return { errorHttp: 500 } }

After uninstall, works normally

tsamaya commented 2 weeks ago

Hi

Thank you for raising the issue.

I spotted this from an Opencage's friend using expo: https://learnetto.com/tutorials/react-native-geocoder.

The issue comes with one of my library's dependencies. The workaround with the debug model can help.

Anyway, I would recommend switching to the next version: https://www.npmjs.com/package/opencage-api-client/v/2.0.0-alpha.3

yarn add opencage-api-client@2.0.0-alpha.3

This new version does not depend on crossfetch. I have not released this version yet since it needs more type definitions.

Please let me know how it goes.