Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'join') #462

Open
ADEV-00 opened this issue Sep 1, 2022 · 2 comments
Open

TypeError: Cannot read properties of undefined (reading 'join') #462

ADEV-00 opened this issue Sep 1, 2022 · 2 comments

Comments

@ADEV-00
Copy link

ADEV-00 commented Sep 1, 2022

I am having problem with spotifyApi.areFollowingPlaylist. I am testing the example you provided

  spotifyApi.areFollowingPlaylist('5ieJqeLJjjI8iJWaxeBLuK', [
          'thelinmichael',
          'ella',
        ])
        .then(
          function (data: any) {
            data.body.forEach(function (isFollowing: any) {
              console.log('User is following: ' + isFollowing)
            })
          },
          function (err: any) {
            console.log('Something went wrong!', err)
          }
        ) 

But I am getting the error: TypeError: Cannot read properties of undefined (reading 'join')

@ADEV-00
Copy link
Author

ADEV-00 commented Sep 2, 2022

For some reason, the function needed a parameter before the playlist id.
I manage to fix my problem like this:

spotifyApi.areFollowingPlaylist('spotify', '5ieJqeLJjjI8iJWaxeBLuK', [
          'thelinmichael',
          'ella',
        ])
        .then(
          function (data: any) {
            data.body.forEach(function (isFollowing: any) {
              console.log('User is following: ' + isFollowing)
            })
          },
          function (err: any) {
            console.log('Something went wrong!', err)
          }
        ) 

Can someone explain to me what this first parameter is?

@kevinguebert
Copy link

Looks like the README may need to be updated as the issue may be coming from the followers being undefined

From:

* Check if users are following a playlist.
* @param {string} userId The playlist's owner's user ID
* @param {string} playlistId The playlist's ID
* @param {String[]} User IDs of the following users
* @param {requestCallback} [callback] Optional callback method to be called instead of the promise.
* @returns {Promise|undefined} A promise that if successful returns an array of booleans. If rejected,
* it contains an error object. Not returned if a callback is given.

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

No branches or pull requests

2 participants