IonicaBizau / node-ipinfo

:globe_with_meridians: An http://ipinfo.io NodeJS wrapper.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting `undefined is not a function`

roshanpaiva opened this issue · comments

When i run this code

var ipInfo;
ipInfo = require("ipinfo");
ipInfo("50.202.37.133", function(err, cLoc) {
  console.log(err || cLoc);
});

I get undefined is not a function. Traced it down to the fact that jsonRequest is using ul 5.2.4. This causes it to return

{code: "ECONNREFUSED",
errno: "ECONNREFUSED",
message: "connect ECONNREFUSED",
stack: undefined,
syscall: "connect"}

Hope this is helpful.

It happened due to a mistake in the previous version of ul (the tests were not covering that use-case also).

Fixed in the latest patch release of ul. npm update should be enough to fix the things. 🚀