Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Intermittent 502 response "Error while loading resource" adding tracks to playlist

Intermittent 502 response "Error while loading resource" adding tracks to playlist

I am using the Add Items to Playlist endpoint to add batches of 100 tracks to a playlist.

 

https://developer.spotify.com/documentation/web-api/reference/add-tracks-to-playlist

 

The batches are sent on a loop with a .333 second delay between each.

 

Intermittently, the API will return a 502 "Error while loading resource" on a given page of this loop.

 

This seems to be a fairly recent development or perhaps it's just happening with more frequency over the last few days.

 

Here's an example of a playlist on my paid plan that experiences the issue.

 

 

And here's the URL that I POST to for adding tracks, which works seemingly most of the time except when it doesn't and we get this 502 "Error while loading resource" response.

 

https://api.spotify.com/v1/playlists/6RGyg7ehntbG2tp1L631cL/track

 

Currently I've reworked my code to simply retry up to two extra attempts when I get a 502 error back, and it seems to work most of the time, but I'd prefer to avoid this (or have it happen with less frequency).

 

Any insight greatly appreciated.

 

Thank you,

TL

 

Reply
6 Replies

Does the behavior change if you lower the batch size? 

I tried as low as 50 per batch / half the max and the issue persisted.

I am having the same issue, but it is occurring with every request to the endpoint. I do not get a status message in the body of the response, just a 502 status code (matches 502 HTTP status code response). Attached is the Postman request that I am using to make the request (saved as .txt file since the file type of attachments is limited). The playlistID and accessToken variables are part of my Postman environment I have set up. I have tried adding multiple variations of these three albums to multiple different playlists in my account, but with no luck.


@toddlevy

The endpoint only accepts "spotify:track:X" and "spotify:episode:X". From the documentation "A comma-separated list of Spotify URIs to add, can be track or episode URIs." If you want to add Albums to a playlist, you first need to fetch the tracks of that Album, and then add them.

 

But we should be returning 400 Bad Request in this case, I'll file a bug report about this.

I am only adding tracks to playlists.

I'm able to get the endpoint working with tracks in an album now, I must have missed that the endpoint only works with tracks and not albums, thank you for pointing that out. I'll post here if I see issues similar to the original post.

Suggested posts

Type a product name