I get an error using reverse lookup with aldeed:geocoder@0.3.7:
var geo = new GeoCoder();
var addr = geo.reverse(45.767, 4.833);
Gives the error below:
W20151006-08:26:25.947(2)? (STDERR) C:\Users\steets\AppData\Local\.meteor\packages\aldeed_geocode
r\0.3.7\npm\node_modules\node-geocoder\lib\geocoder.js:60
W20151006-08:26:25.947(2)? (STDERR) return callback(err, data);
W20151006-08:26:25.947(2)? (STDERR) ^
W20151006-08:26:25.947(2)? (STDERR) TypeError: number is not a function
This happens on both my development machine as in deployment.
Using node-inspector I have traced the problem to Meteor.wrapAsync
at aldeed_geocoder.js:61:
GeoCoder.prototype.reverse = function geoCoderReverse(lat, lng, callback) {
if (callback) {
callback = Meteor.bindEnvironment(callback, function (error) {
if (error) throw error;
});
rv(lat, lng, this.options, callback);
} else {
return Meteor.wrapAsync(rv)(lat, lng, this.options);
}
};
(rv
calls the reverse
function of node-geocoder
, mentioned in the error)
Then wrapAsync
fails on the very last line:
return fut ? fut.wait() : result;
Running meteor update
indicates I have the latest meteor and packages.
I tried to recreate this error in a vanilla app, following the package README (https://github.com/aldeed/meteor-geocoder):
meteor create test
cd test
meteor add aldeed:geocoder
meteor
and then in a new terminal:
meteor shell
> var geo = new GeoCoder()
> geo.geocode('29 champs elysée paris')
[ { formattedAddress: '29 Av. des Champs-Élysées, 75008 Paris, France',
....
zipcode: '75008' } ]
> geo.reverse(45.767, 4.833)
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: read ECONNRESET
at errnoException (net.js:905:11)
at TCP.onread (net.js:559:19)
This is a different error, but it still doesn't work and maybe this is the underlying cause.
I recently upgraded to meteor 1.2. This code used to work fine under meteor 1.1.
Any help would be greatly appreciated. I am at a complete loss.
Turned out to be a bug. Fixed by package maintainer :)