Node hangs using Flickr.authenticate
When using the Flickr.authenticate method, everything behaves as expected (authentication, making API calls) but the Node process won't exit by itself.
This seems similar to what @cheapsteak was experiencing in #71 here
Here's a sample application that reproduces the behaviour:
var habitat = require('habitat')
var env = habitat.load(__dirname+'/../.env'); // based on the sample .env file
var Flickr = require('flickrapi')
Flickr.authenticate(env.get('flickr'),function(err, flickr) {
if (err) throw err;
flickr.photos.search({
user_id: flickr.options.user_id,
page: 1,
per_page: 20,
extras: ['description','license','url_m'],
authenticated: true
}, function(err, result) {
if (err) throw err;
result.photos.photo.forEach(function(photo){
console.log(photo)
})
});
});
thanks, I'm going to see if I can figure out which callback is kept open...
I'm using Flickr.tokenOnly(...) but I've also had the process not exit by itself. But I figured out that if I disable the progress bar in the options it exits correctly.
So maybe it's the progress bar that keeps the process running? I haven't tried Flickr.authenticate() though.
const flickrOptions = {
api_key: 'lol',
secret: 'yolo',
progress: false
};
Flickr.tokenOnly(flickrOptions, function(err, flickr) {
// ...
});
Interesting, I'll strip the progress bar and see if that makes a difference for the plain auth code too. Good find.
I can also confirm that this is related to setting the progress param in flickrOptions when calling tokenOnly. I was debugging stalled tests and was led to flickrapi, set progress: true (true accidentally), and the tests stopped hanging. I would like to propose setting the default option to false so as to minimize unexpected logging.