adamgrieger/spotify-web-api-ts

player.getCurrentlyPlayingTrack triggers a 400 response

Opened this issue · 0 comments

I think the parameter market for player.getCurrentlyPlayingTrack should be required.

I've been the whole day dealing with a code 400 (bad request) response after using player.getCurrentlyPlayingTrack, I think the problem is that for the endpoint used (https://api.spotify.com/v1/me/player/currently-playing) the query parameter market is required while player.getCurrentlyPlayingTrack takes it as an optional parameter.

After setting the market it started to work just fine:

const webApi = new SpotifyWebApi({clientId, clientSecret, redirectUri, accessToken});
const currentlyPlaying = await webApi.player.getCurrentlyPlayingTrack({
        market: 'ES',
});

I apologize if there is something I am overlooking 😅