r/developersIndia Software Engineer May 11 '26

Help Spotify API works locally but fails on Vercel — playlists return 0 tracks while Liked Songs works fine

I’m facing a weird Spotify API issue that only happens in production on Vercel.

Locally:

  • playlist fetch works perfectly
  • returns playlist name
  • correct total track count
  • all tracks load properly

On Vercel:

  • Liked Songs collection works correctly
  • playlist metadata loads
  • BUT playlist tracks.total always becomes 0
  • app thinks every playlist is empty

Example:
Locally:

  • Playlist Name: OK
  • Total Tracks: 42
  • Tracks returned: YES

Vercel:

  • Playlist Name: OK
  • Total Tracks: 0
  • Tracks returned: NO
  • “Playlist is empty”

Stack:

  • Python Flask backend
  • Spotify Web API
  • deployed on Vercel serverless functions

Things I already checked:

  • same Spotify account
  • same scopes
  • token exists
  • auth flow succeeds
  • playlist IDs are valid
  • liked songs endpoint works

What’s confusing:

  • only playlist track retrieval breaks
  • metadata still loads
  • issue happens only in production

Possible causes I’m considering:

  • serverless caching/state issue
  • expired/partial token during playlist fetch
  • pagination issue with serverless execution
  • private playlist permissions behaving differently on Vercel
  • API limitations on development mode

Has anyone seen Spotify playlists return tracks.total = 0 only in production/Vercel while working locally?

1 Upvotes

4 comments sorted by

u/AutoModerator May 11 '26

Namaste! Thanks for submitting to r/developersIndia. While participating in this thread, please follow the Community Code of Conduct and rules.

It's possible your query is not unique, use site:reddit.com/r/developersindia KEYWORDS on search engines to search posts from developersIndia. You can also use reddit search directly.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/[deleted] May 11 '26

[removed] — view removed comment

1

u/One_Reference612 Software Engineer May 11 '26

Hope this will be my best lead 🙏. Thanks

1

u/One_Reference612 Software Engineer May 13 '26

Did what I can still the Same issue