Skip to content

Faraday::ServerError: the server responded with status 500 (erroneous failing call to profile by a student to list students) #596

@sentry-io

Description

@sentry-io

We are seeing a large number of these errors in Sentry, nearly 1k a day on busier days.

This looks to be happening when a student opens a project, which calls the show action in projects_controller, which in turn calls the @project.with_user call, which then calls SchoolStudent::List which will fail as students aren't allowed to list students. We should put a guard on this to prevent it happening when the current user is a student.

This error isn't being surfaced to the user, but is causing a lot of noise in Sentry and pointless requests, we've seen 14k since it was introduced and that has ramped up a lot recently with our increased traffic.


Sentry Issue: EDITOR-API-4X

Faraday::ServerError: the server responded with status 500 for POST https://my.raspberrypi.org/api/v1/schools/ecaca07f-6d9f-4d0a-9d70-4e0e73ddf6be/students/list (Faraday::ServerError)
  lib/profile_api_client.rb:69:in `list_school_students'
    response = connection(token).post("/api/v1/schools/#{school_id}/students/list") do |request|
  lib/concepts/school_student/list.rb:20:in `list_students'
    ProfileApiClient.list_school_students(token:, school_id: school.id, student_ids:).map do |student|
  lib/concepts/school_student/list.rb:8:in `call'
    response[:school_students] = list_students(school, token, student_ids)
  app/models/project.rb:57:in `with_user'
    students = SchoolStudent::List.call(school:, token: current_user.token,
  app/controllers/api/projects_controller.rb:21:in `show'
    project_with_user = @project.with_user(current_user)
...
(94 additional frame(s) were not displayed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions