maxmind/GeoIP2-node

Uncaught exceptions "TypeError: Cannot read property 'continent' of undefined" happening on some requests

cibergarri opened this issue · 2 comments

Environment

  • __OS Version(s): ? ...
  • __Node Version(s):10.22.0 ...
  • __GeoIP2-node Version(s):2.3.2...

Questionnaire

I'm using GeoIP2-node for...

  • ...database lookups.
  • ...web service calls.

Requested priority:

  • Blocking
  • High
  • [ X] Normal
  • Low

Willing to submit pull request:

  • [ X] Yes
  • No

Expected Behavior

Not throwing Uncaught exceptions

Throwing exceptions that cannot be caught in the flow

Steps to Reproduce the Bug

I got this error when I use the minfraud insights api, but not always, just from time to time. It looks like the response does not have the correct format so is not being correctly parsed.

I was using minfraud-api-node version 3.2.0 and I upgraded to 3.4.0 but it didn't fixed the issue

TypeError: Cannot read property 'continent' of undefined at new Country (/code/node_modules/@maxmind/geoip2-node/dist/src/models/Country.js:10:44) at new City (/code/node_modules/@maxmind/geoip2-node/dist/src/models/City.js:7:9) at new Insights (/code/node_modules/@maxmind/geoip2-node/dist/src/models/Insights.js:6:9) at Insights.getIpAddress (/code/node_modules/@maxmind/minfraud-api-node/dist/src/response/models/insights.js:22:26) at new Insights (/code/node_modules/@maxmind/minfraud-api-node/dist/src/response/models/insights.js:13:31) at IncomingMessage.response.on (/code/node_modules/@maxmind/minfraud-api-node/dist/src/webServiceClient.js:60:36) at IncomingMessage.emit (events.js:203:15) at IncomingMessage.EventEmitter.emit (domain.js:448:20) at endReadableNT (_stream_readable.js:1145:12) at process._tickCallback (internal/process/next_tick.js:63:19)

Thanks for catching this issue. This is actually an issue with the minFraud API node library and should have been posted there.

We should have a fix for it soon, but do note that you'll need to upgrade your Node version to at least 12 to use it; we dropped Node 10 support due to it being out of the LTS cycle.

Hey @kevcenteno! thanks for the prompt answer!

this is actually an issue with the minFraud API node library and should have been posted there.

I tried to post there and I couldn't, I think I was doing something wrong, because I have been able to create it now:
maxmind/minfraud-api-node#515

Feel free to close this 🙂