Jammming Project - 429 Error, and weird search button press errors?


I have encountered an issue with the Jammming project. I have just implemented the search integration with the spotify API. It works and returns tracks from the spotify database, but with some strange caveats?

1.) I am getting constant 429 errors in chrome dev tools, no idea why?
2.) If i press the search button more than once, I can get a range of 400 or 401 errors. Im not sure why even though typing in the field and pressing the search button works?
3.) Every second press of the search button refreshes the whole page?

My github is here: GitHub - tsewell93/jammming: React App used to create Spotify playlists

Any help greatly appreciated.

I’ve worked out what the problem is through some debugging. I had a couple of problems in case any in future is interested or has a similar problem! in Spotify.js I had set the initial definition of accessToken as an empty string, instead of just stating let accessToken. This was causing some issues in the getAccessToken method.

Also later on, in the getAccessToken method I ran into an issue where I was getting 401 errors on my GET and POST calls. This was due to an error where i’d stated const tokenExpiration = Number(accessTokenMatch[1]); instead of const tokenExpiration = Number(tokenExpirationMatch[1]);.

Maybe this helps someone find an error in the future!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.