Skip to content
This repository has been archived by the owner on Aug 17, 2019. It is now read-only.

Node hangs using Flickr.authenticate #73

Open
colophonemes opened this issue Jan 31, 2016 · 4 comments
Open

Node hangs using Flickr.authenticate #73

colophonemes opened this issue Jan 31, 2016 · 4 comments

Comments

@colophonemes
Copy link

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)
        })
    });
});
@Pomax
Copy link
Owner

Pomax commented Jan 31, 2016

thanks, I'm going to see if I can figure out which callback is kept open...

@Pomax Pomax added the bug label Jan 31, 2016
@maxkueng
Copy link

maxkueng commented Jul 3, 2016

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) {
  // ...
});

@Pomax
Copy link
Owner

Pomax commented Jul 4, 2016

Interesting, I'll strip the progress bar and see if that makes a difference for the plain auth code too. Good find.

@ox
Copy link

ox commented Jul 30, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants