spotify-api / spotify-api.js

A complete wrapper for spotify web api for deno, node.js and the browser.
https://spotify-api.js.org
MIT License
214 stars 19 forks source link

Replacing playlist tracks broken in v9.2.2 #157

Closed peterjuras closed 2 years ago

peterjuras commented 2 years ago

Bug Report

What i expected:

Replacing tracks in a playlist should work using the spotifyApi.playlists.reorderItems(...) API.

What actually happened:

Replacing tracks no longer works, because there is a wrong body property uri instead of uris (plural)

This is likely because in this line the uri parameter is used instead of uris. (See Spotify API reference)

To reproduce this bug:

const spotifyApi = await Client.create({
    token: {
      clientID: SPOTIFY_CLIENT_ID,
      clientSecret: SPOTIFY_CLIENT_SECRET,
      refreshToken: spotifyUser.refreshToken,
    },
    userAuthorizedToken: true,
    refreshToken: true,
  });

const playlistId = "VALID PLAYLIST ID"
const trackUris = ['VALID TRACK URIS']

await spotifyApi.playlists.reorderItems(playlistId, {
  uris: trackUris,
});
peterjuras commented 2 years ago

I created pull request #158 which solves this issue.