Uploaded image for project: 'SimplyE 2.0'
  1. SimplyE 2.0
  2. SIMPLY-503

500 error from analytics controller when LicensePool can't be found.

XMLWordPrintable

      https://circulation.librarysimplified.org/analytics/Library%20Simplified%20Open%20Access%20Content%20Server/URI/https://unglue.it/api/id/work/156702/open_book gives a 500 error. There are two problems here. The first is the problem we're having with

      load_licensepool

      . It should find the book (the RTC edition of "War and Peace") but it doesn't. Maybe it's confused because the book's DataSource is really unglue.it and not the open-access content server? Anyway, that's the first problem.

      The 500 error happens because

      AnalyticsController.track_event()

      is missing some boilerplate:

      --- a/api/controller.py
      +++ b/api/controller.py
      @@ -1052,6 +1052,8 @@ class AnalyticsController(CirculationManagerController):
           def track_event(self, data_source, identifier_type, identifier, event_type):
               if event_type in CirculationEvent.CLIENT_EVENTS:
                   pool = self.load_licensepool(data_source, identifier_type, identifier)
      +            if isinstance(pool, ProblemDetail):
      +                return pool
                   Analytics.collect_event(self._db, pool, event_type, datetime.datetime.utcnow())
                   return Response({}, 200)
               else:
      

      Marking this issue as 'important' because it creates 500 errors on production. However, I tested this book in SimplyE and the errors didn't cause any client problems.

      Issue is synchronized with a GitHub issue
      Repository Name: circulation
      Issue Number: 481

            Unassigned Unassigned
            github Github Sync
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: