CAVaccineInventory / vial

The Django application powering calltheshots.us

Home Page:https://vial.calltheshots.us

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IntegrityError: insert or update on table "api_log" violates foreign key constraint "api_log_api_key_id_5344156a_...

sentry-io opened this issue · comments

Sentry Issue: VIAL-C9

ForeignKeyViolation: insert or update on table "api_log" violates foreign key constraint "api_log_api_key_id_5344156a_fk_api_apikey_id"
DETAIL:  Key (api_key_id)=(27) is not present in table "api_apikey".

  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

IntegrityError: insert or update on table "api_log" violates foreign key constraint "api_log_api_key_id_5344156a_fk_api_apikey_id"
DETAIL:  Key (api_key_id)=(27) is not present in table "api_apikey".

(15 additional frame(s) were not displayed)
...
  File "django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "beeline/middleware/django/__init__.py", line 59, in __call__
    result = execute(sql, params, many, context)
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

That's because I deleted an API key which I had accidentally shared in a comment - #724 (comment) - but it looks like a scheduled task ran before I had updated that API key in the Cloud Schedule configuration. This error should not occur again.