brim-borium/spotify_sdk

502 errors when attempting any action with the API

banool opened this issue · 2 comments

Is this a how to question?
No

Is this a native Spotify SDK issue?
No

Have you searched for existing issues?
Yes

Are you using a Free or Premium Spotify account?
Premium

Are you aware of the limitations of Free Spotify accounts?
Yes

Expected behavior
I can call the functions under SpotifySDK which are supported according to the README and they work.

Describe the bug
First, actual repro steps. The code in question is all here. You can go there and run flutter run -d chrome --release, log in, then hit "tune in". If you actually try these repro steps, I imagine I'll need to add your email to the set of authorized users for the app from the Spotify dashboard.

So, the problem I'm seeing is this. You can see here the code I use to login to Spotify. This works. After this however, any attempt to use the spotify SDK fails. For example, trying to queue up a track here. Instead, I get this error.

I've tried many things, such as:

  • Don't get an access token first, just connect.
  • Try different scopes.
  • Don't set a player name.
  • Await longer to get the player state (which also fails).
  • Try a bunch of other actions first, such as playing a track.

Strangely, the connection still seems to be somewhat alive, because from the desktop / web Spotify app I can see the player and play to it and it'll come from that web page.

I should say that everything works fine for iOS and Android.

Any help with this would be much appreciated, I'm pretty much out of ideas. Thanks a lot!

Steps to Reproduce
See above.

Screenshots
N/A

spotify_sdk Flutter package version
2.3.0

Target Platform, Version & Device

  • OS & Version: Web
  • Browser & Version: Chrome 101.0.4951.64
  • Device: M1 Mac 2022

Development OS

  • OS: MacOS

Additional context
N/A

I looked at the example code and couldn't figure out what I'm doing differently also.

Okay seems like the issues where these:

  • With the web API it works best to play a song first prior to queuing anything.
  • We don't want to always target a particular player, that causes the 502s.

For the latter, I've got some changes in https://github.com/banool/spotify_sdk/. I can make PRs out of these if folks think they're reasonable, but now I'll be using my own branch.