There was a problem when working with Spotify API, trying to get the value of the key of the duration of the track being played, but as a result “undefined”. I get it like this:
const data = await spotifyApi.getMyCurrentPlaybackState(userID);
console.log(data.body.duration_ms);
If you try to output Body yourself, then it has this key in it, and it has the value of the length of the track in milliseconds
console.log(data.body)