javascript - Error: getaddrinfo EAI_AGAIN api.spotify.com:443 - Stack Overflow

While I am in a process of integrating Spotify API into Google Assistant app, implementing Account Link

While I am in a process of integrating Spotify API into Google Assistant app, implementing Account Linking,

getaddrinfo EAI_AGAIN api.spotify:443

This above error has been kept ing out in the console, although it seems to be working like nothing is wrong around API implementation. The access token is properly created and received and client and secret ids were filled without any typo. Also, I tested API calls on Spotify Console (/). No error was found. It fetched expected data from the Spotify server, so it should not be related to Account Linking and Spotify Server. The created code myself is below: I assume there is something wrong around spotify-web-api-node, node, npm, or firebase-functions?? I recently have done node versioning so I might did something wrong.

  • Node version: v7.9.0
  • spotify-web-api-node: ^4.0.0
  • firebase-functions: ^2.0.3
  • npm version: 6.4.1
  • Added engines: { "node": "8" } // this is in package.json to use asyn and await

app.intent(SomeIntent, async (conv, params) => {
    console.log('user info', JSON.stringify(conv.user));
    conv.ask('lets play'); //okay
    const access_token = conv.user.access.token || ''; // okay
    console.log('Your TOKEN information here: ' + access_token); // okay
    spotifyApi.setAccessToken(access_token); // should be set correctly
    let data = await findMusic(); // error in the findMusic func
    conv.ask('found this song。', data.name); //  so no data.name
});

function findMusic() {
    return spotifyApi.getArtistAlbums('43ZHCT0cAZBISjO8DG9PnE').then((data) => {
        console.log('artist song', data.body);
        return data.body; //this does not return because error is produced
    }).catch(err => {
        console.log('Something went wrong!', err);
        return err; // this error is WebapiError: getaddrinfo EAI_AGAIN api.spotify:443
    });
}

While I am in a process of integrating Spotify API into Google Assistant app, implementing Account Linking,

getaddrinfo EAI_AGAIN api.spotify.:443

This above error has been kept ing out in the console, although it seems to be working like nothing is wrong around API implementation. The access token is properly created and received and client and secret ids were filled without any typo. Also, I tested API calls on Spotify Console (https://developer.spotify./console/get-artist-albums/). No error was found. It fetched expected data from the Spotify server, so it should not be related to Account Linking and Spotify Server. The created code myself is below: I assume there is something wrong around spotify-web-api-node, node, npm, or firebase-functions?? I recently have done node versioning so I might did something wrong.

  • Node version: v7.9.0
  • spotify-web-api-node: ^4.0.0
  • firebase-functions: ^2.0.3
  • npm version: 6.4.1
  • Added engines: { "node": "8" } // this is in package.json to use asyn and await

app.intent(SomeIntent, async (conv, params) => {
    console.log('user info', JSON.stringify(conv.user));
    conv.ask('lets play'); //okay
    const access_token = conv.user.access.token || ''; // okay
    console.log('Your TOKEN information here: ' + access_token); // okay
    spotifyApi.setAccessToken(access_token); // should be set correctly
    let data = await findMusic(); // error in the findMusic func
    conv.ask('found this song。', data.name); //  so no data.name
});

function findMusic() {
    return spotifyApi.getArtistAlbums('43ZHCT0cAZBISjO8DG9PnE').then((data) => {
        console.log('artist song', data.body);
        return data.body; //this does not return because error is produced
    }).catch(err => {
        console.log('Something went wrong!', err);
        return err; // this error is WebapiError: getaddrinfo EAI_AGAIN api.spotify.:443
    });
}

UPDATE

@Nick-Felker mentioned in the ment below that external calls are allowed only through paid plans. So this might be the solution (not proved to be working right now because I am not using a paid plan. The detailed explanation below is quoted from An answer ment from another StackOverflow post

The Spark plan allows outbound network requests only to Google-owned services. Inbound invocation requests are allowed within the quota. On the Blaze plan, Cloud Functions provides a perpetual free tier. The first 2,000,000 invocations, 400,000 GB-sec, 200,000 CPU-sec, and 5 GB of Internet egress traffic is provided for free each month. You are only charged on usage past this free allotment. Pricing is based on total number of invocations, and pute time. Compute time is variable based on the amount of memory and CPU provisioned for a function. Usage limits are also enforced through daily and 100s quotas. For more information, see Cloud Functions Pricing.

UPDATE

In my case, the above solution worked. Hope this article helps others!

Share Improve this question edited Nov 5, 2018 at 2:38 Ryohei asked Nov 2, 2018 at 2:48 RyoheiRyohei 7132 gold badges10 silver badges20 bronze badges 6
  • 1 EAI_AGAIN is a DNS lookup error!! More details can be found at stackoverflow./a/40182520/6611700 – riyaz-ali Commented Nov 2, 2018 at 4:19
  • @riyaz-ali thanks for the reply. I am doing ''npm install latest-version'' to see if that works. But does not seem to work.... What else do you think I should do – Ryohei Commented Nov 2, 2018 at 4:47
  • 3 Are you using the Blaze plan for Firebase? Firebase blocks external network calls on the free tier. – Nick Felker Commented Nov 2, 2018 at 5:24
  • 1 @NickFelker the current plan of Firebase is Spark, so yes it is a free plan. So you mean if I swtich to Blaze plan, you think this can be fixed? Then I will test this later when I switch to my another account. Also do you think there are some possible clues that point out this bug? – Ryohei Commented Nov 2, 2018 at 5:28
  • Yeah I looked through other articles and Firebase Price page, and people also mentioned that. stackoverflow./a/43645498/9363250 I will upvote your ment as soon as I test it. Thank you very much. – Ryohei Commented Nov 2, 2018 at 5:36
 |  Show 1 more ment

1 Answer 1

Reset to default 1

I got this error due to network problem. And solved when connected

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745086352a4610428.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信