spotify-web-api-node
spotify-web-api-node copied to clipboard
TypeError: Cannot read properties of undefined (reading 'join')
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')
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?
Looks like the README may need to be updated as the issue may be coming from the followers being undefined
From: https://github.com/thelinmichael/spotify-web-api-node/blob/be15f1c742b35134ce5bd35521d8bf1ab1ba67cf/src/spotify-web-api.js#L1342-L1348