Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-1074

Reconnecting Spotify violates uniqueness constraint

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • None
    • None
    • None

      After receiving this email from ListenBrainz:

      Hi!

      We encountered an error while importing your listens from Spotify.
      The error was as follows: "It seems like you've revoked permission for us to read your spotify account"

      Please take a look at your Spotify import page (https://listenbrainz.org/profile/music-services/details/)
      for more information.

      Best,
      The ListenBrainz Team

      I clicked "Activate both features" from the page linked above and reauthorized ListenBrainz to access my Spotify account.

      The callback handler, however, gave the following error, implying to me an insert needs to be changed to an upsert:

      Internal server error

      (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "user_id_service_ndx_listens_importer" DETAIL: Key (user_id, service)=(12985, spotify) already exists. [SQL: INSERT INTO listens_importer (external_service_oauth_id, user_id, service) VALUES (%(external_service_oauth_id)s, %(user_id)s, %(service)s) ] [parameters: \{'external_service_oauth_id': 12872, 'user_id': 12985, 'service': 'spotify'}] (Background on this error at: http://sqlalche.me/e/13/gkpj)

            kartik1712 amCap1712
            aakside aakside
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package