question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SpotifyAPI.Web.APIException: Server error when calling Tracks.Get()

See original GitHub issue

Steps to reproduce:

 var config = SpotifyClientConfig
              .CreateDefault()
              .WithAuthenticator(new ClientCredentialsAuthenticator(SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET));
 var api = new SpotifyClient(config);

// Try to get IPlayableItem
 track = await api.Tracks.Get("7CsdHQZlVcksVMwGlvulD0"); // here throws exception
SpotifyAPI.Web.APIException: Server error.
   at SpotifyAPI.Web.Http.APIConnector.ProcessErrors(IResponse response)
   at SpotifyAPI.Web.Http.APIConnector.DoRequest(IRequest request)
   at SpotifyAPI.Web.Http.APIConnector.DoSerializedRequest[T](IRequest request)
   at SpotifyAPI.Web.Http.APIConnector.SendAPIRequest[T](Uri uri, HttpMethod method, IDictionary`2 parameters, Object body, IDictionary`2 headers)
   at spotytovkshare_backend.Controllers.Spotify2Controller.GetSearchName(String uri) in M:\GitHub\spotytovkshare_backend\Controllers\SpotifyController.cs:line 175
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Implelentation: https://github.com/rhiskey/spotytovkshare_backend/blob/a0a1d07e88adbea4a2fd3b9abedba6c5e4682104/Controllers/SpotifyController.cs#L172

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JohnnyCrazycommented, Jun 6, 2022

So I tried to reproduce it with ClientCredentialsAuthenticator, but was unable to.

SpotifyClientConfig config = SpotifyClientConfig.CreateDefault().WithAuthenticator(new ClientCredentialsAuthenticator(
  "ClientId", "ClientSecret"
));

SpotifyClient spotify = new(config);
FullTrack track = await spotify.Tracks.Get("2KqwH2jVrO4rjYJ6O6XTLO");

Console.WriteLine(track.Name);

Due to the fact that the error just says Server Error. I would also assume something is wrong on Spotify’s end. If there would be sth wrong with the token, which we can fix, it would be some kind of invalid_access_token error.

I’m closing it for now, but feel free to contact spotify in the forums and update us here!

1reaction
JohnnyCrazycommented, May 19, 2022

I will recheck within next week if it’s maybe related to the ClientCredentialsAuthenticator, although I doubt it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Handling | SpotifyAPI-NET
API calls can fail when input data is malformed or the server detects issues with the request. As an example, the following request ......
Read more >
API calls
The Spotify Web API is a restful API with different endpoints which return JSON metadata about music artists, albums, and tracks, directly from...
Read more >
How can I get the currently playing track from spotify using ...
I am trying to use SpotifyAPI.Web for C#, in order to get the currently playing track from my Spotify-player. Here is my code...
Read more >
SpotifyException: http status: 500 · Issue #353 · spotipy-dev ...
After a few songs I seem to be getting a 500 from Spotify. Below is my error: Traceback (most recent call last): File...
Read more >
Spotify Integration - "500 Internal Server Error"
I can't integrate Spotiy anymore in Version 0.115.2. First, it ends in " INVALID_CLIENT: Invalid redirect URI". As written in the documentation, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found