You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Situation
During the early stages of development, before getting around to implementing caching & API throttling, I inadvertently triggered a re-render loop on the frontend. This caused an excessive number of requests to the backend, which in turn spammed the Spotify API.
Consequently, my app was suspended for approximately 24 hours and I began receiving the following responses:
GET /v1/artists/5zixe6AbgXPqt4c1uSl94L HTTP/1.1Content-Type: application/jsonAuthorization: Bearer ████████████████████████████████████████████████████████████████████████████████████████████████████████████User-Agent: PostmanRuntime/7.37.3Accept: */*Postman-Token: ███████████████████████████████████Host: api.spotify.comAccept-Encoding: gzip, deflate, brConnection: keep-aliveHTTP/1.1 429 Too Many Requestscache-control: private, max-age=0retry-after: 74523access-control-allow-origin: *access-control-allow-headers: Accept, App-Platform, Authorization, Content-Type, Origin, Retry-After, Spotify-App-Version, X-Cloud-Trace-Context, client-token, content-access-tokenaccess-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE, PATCHaccess-control-allow-credentials: trueaccess-control-max-age: 604800content-encoding: gzipstrict-transport-security: max-age=31536000x-content-type-options: nosniffdate: Sun, 30 Jun 2024 02:39:13 GMTserver: envoyVia: HTTP/2 edgeproxy, 1.1 googleAlt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000Transfer-Encoding: chunkedToo many requests
Notice that the retry-after header is 74623 and the response body is not in JSON format as expected. This causes zmb3/spotify to throw a "spotify: couldn't decode error: (17) [Too many requests]" error.
Suggestions
Handle the plain text response body as an edge case.
Situation
During the early stages of development, before getting around to implementing caching & API throttling, I inadvertently triggered a re-render loop on the frontend. This caused an excessive number of requests to the backend, which in turn spammed the Spotify API.
Consequently, my app was suspended for approximately 24 hours and I began receiving the following responses:
Notice that the
retry-afterheader is74623and the response body is not in JSON format as expected. This causeszmb3/spotifyto throw a "spotify: couldn't decode error: (17) [Too many requests]" error.Suggestions
maxWait(also suggested in Client is (too) quiet if it has to retry #241) or similar mechanism for retries.retry-afterheader value so the application can decide how to handle the situation.