wakapi icon indicating copy to clipboard operation
wakapi copied to clipboard

2.14.0: receiving "Error: Resource not found" when hitting API and logging in via UI

Open lrstanley opened this issue 6 months ago • 1 comments

Describe the bug

Upgrading to 2.14.0, and seeing the following error on the POST request to /login (after providing credentials) when logging in via the UI:

Looks like it returns a 404 as a response to the POST.

I've since restored my DB, and rolled back to the previous WakAPI version, and it's working again.

Env vars I'm using:

    - name: ENVIRONMENT
      value: prod
    - name: WAKAPI_ALLOW_SIGNUP
      value: "false"
    - name: WAKAPI_DB_HOST
      value: wakapi-postgres-rw
    - name: WAKAPI_DB_NAME
      value: app
    - name: WAKAPI_DB_PASSWORD
      valueFrom:
        secretKeyRef:
          key: password
          name: wakapi-postgres-app
    - name: WAKAPI_DB_PORT
      value: "5432"
    - name: WAKAPI_DB_TYPE
      value: postgres
    - name: WAKAPI_DB_USER
      valueFrom:
        secretKeyRef:
          key: username
          name: wakapi-postgres-app
    - name: WAKAPI_DISABLE_FRONTPAGE
      value: "true"
    - name: WAKAPI_INSECURE_COOKIES
      value: "false"
    - name: WAKAPI_LEADERBOARD_ENABLED
      value: "false"
    - name: WAKAPI_LISTEN_IPV4
      value: 0.0.0.0
    - name: WAKAPI_PORT
      value: "3000"
    - name: WAKAPI_PUBLIC_URL
      value: https://wakapi.liam.sh
    - name: WAKAPI_PASSWORD_SALT
      valueFrom:
        secretKeyRef:
          key: WAKAPI_PASSWORD_SALT
          name: wakapi-env-vars

System information

  • Wakapi version: 2.14.0
  • Operating system
    • docker (kubernetes): ghcr.io/muety/wakapi:2.14.0
  • Database: Postgres 17

lrstanley avatar Jun 22 '25 09:06 lrstanley

That's strange. Can you please verify that your user actually still exists in the database after the upgrade? Also, judging by your environment config, WAKAPI_TRUSTED_HEADER_AUTH is not explicitly configured and thus should be set to the default value of false, correct?

muety avatar Jun 24 '25 06:06 muety

Initial startup logs for 2.14.0 from 2.13.x:

{"time":"2025-06-24T22:42:50.963949297Z","level":"INFO","msg":"disabling data retention policy, keeping data forever"}
{"time":"2025-06-24T22:42:50.964037781Z","level":"INFO","msg":"Wakapi","version":"2.14.0\n"}
{"time":"2025-06-24T22:42:50.964049606Z","level":"INFO","msg":"starting with database","dialect":"postgres"}
{"time":"2025-06-24T22:42:50.991179495Z","level":"INFO","msg":"potentially running migration","name":"20201103-rename_language_mappings_table"}
{"time":"2025-06-24T22:42:51.023697685Z","level":"INFO","msg":"potentially running migration","name":"20201106-migration_cascade_constraints"}
{"time":"2025-06-24T22:42:51.032329235Z","level":"INFO","msg":"no need to migrate","name":"20201106-migration_cascade_constraints"}
{"time":"2025-06-24T22:42:51.032355799Z","level":"INFO","msg":"potentially running migration","name":"20210202-fix_cascade_for_alias_user_constraint"}
{"time":"2025-06-24T22:42:51.034775583Z","level":"INFO","msg":"no need to migrate","name":"20210202-fix_cascade_for_alias_user_constraint"}
{"time":"2025-06-24T22:42:51.0347924Z","level":"INFO","msg":"potentially running migration","name":"20220403-drop_user_project_idx"}
{"time":"2025-06-24T22:42:51.037834513Z","level":"INFO","msg":"no need to migrate","name":"20220403-drop_user_project_idx"}
{"time":"2025-06-24T22:42:51.037855124Z","level":"INFO","msg":"potentially running migration","name":"20220930-drop_heartbeats_entity_idx"}
{"time":"2025-06-24T22:42:51.056975433Z","level":"INFO","msg":"potentially running migration","name":"20221002-fix_summary_id_types"}
{"time":"2025-06-24T22:42:51.057028539Z","level":"INFO","msg":"potentially running migration","name":"20221028-fix_heartbeats_time_user_idx"}
{"time":"2025-06-24T22:42:51.075514364Z","level":"INFO","msg":"potentially running migration","name":"20250425-add_durations_primary_key"}
{"time":"2025-06-24T22:42:52.16321668Z","level":"INFO","msg":"potentially running migration","name":"20210206_drop_badges_column_add_sharing_flags"}
{"time":"2025-06-24T22:42:52.167097767Z","level":"INFO","msg":"potentially running migration","name":"20210213-add_has_data_field"}
{"time":"2025-06-24T22:42:52.168056928Z","level":"INFO","msg":"no need to migrate","name":"20210213-add_has_data_field"}
{"time":"2025-06-24T22:42:52.168137532Z","level":"INFO","msg":"potentially running migration","name":"20210221-add_created_date_column"}
{"time":"2025-06-24T22:42:52.16880371Z","level":"INFO","msg":"no need to migrate","name":"20210221-add_created_date_column"}
{"time":"2025-06-24T22:42:52.168818464Z","level":"INFO","msg":"potentially running migration","name":"20210411-add_imprint_content"}
{"time":"2025-06-24T22:42:52.169673782Z","level":"INFO","msg":"no need to migrate","name":"20210411-add_imprint_content"}
{"time":"2025-06-24T22:42:52.169748355Z","level":"INFO","msg":"potentially running migration","name":"20210411-drop_migrations_table"}
{"time":"2025-06-24T22:42:52.170459725Z","level":"INFO","msg":"dropped table","table":"gorp_migrations"}
{"time":"2025-06-24T22:42:52.170475329Z","level":"INFO","msg":"potentially running migration","name":"20210806-remove_persisted_project_labels"}
{"time":"2025-06-24T22:42:52.171066509Z","level":"INFO","msg":"no need to migrate","name":"20210806-remove_persisted_project_labels"}
{"time":"2025-06-24T22:42:52.171138465Z","level":"INFO","msg":"potentially running migration","name":"20211215-migrate_id_to_bigint-add_has_data_field"}
{"time":"2025-06-24T22:42:52.171739864Z","level":"INFO","msg":"no need to migrate","name":"20211215-migrate_id_to_bigint-add_has_data_field"}
{"time":"2025-06-24T22:42:52.171753881Z","level":"INFO","msg":"potentially running migration","name":"20212212-total_summary_heartbeats"}
{"time":"2025-06-24T22:42:52.172381246Z","level":"INFO","msg":"no need to migrate","name":"20212212-total_summary_heartbeats"}
{"time":"2025-06-24T22:42:52.172482455Z","level":"INFO","msg":"potentially running migration","name":"20220317-align_num_heartbeats"}
{"time":"2025-06-24T22:42:52.173016708Z","level":"INFO","msg":"no need to migrate","name":"20220317-align_num_heartbeats"}
{"time":"2025-06-24T22:42:52.173029703Z","level":"INFO","msg":"potentially running migration","name":"20220318-mysql_timestamp_precision"}
{"time":"2025-06-24T22:42:52.173623538Z","level":"INFO","msg":"no need to migrate","name":"20220318-mysql_timestamp_precision"}
{"time":"2025-06-24T22:42:52.17372977Z","level":"INFO","msg":"potentially running migration","name":"202203191-drop_diagnostics_user"}
{"time":"2025-06-24T22:42:52.174376685Z","level":"INFO","msg":"no need to migrate","name":"202203191-drop_diagnostics_user"}
{"time":"2025-06-24T22:42:52.174390936Z","level":"INFO","msg":"potentially running migration","name":"20221016-drop_rank_column"}
{"time":"2025-06-24T22:42:52.175053647Z","level":"INFO","msg":"no need to migrate","name":"20221016-drop_rank_column"}
{"time":"2025-06-24T22:42:52.175168237Z","level":"INFO","msg":"potentially running migration","name":"20230219-add_astro_language"}
{"time":"2025-06-24T22:42:52.175890333Z","level":"INFO","msg":"no need to migrate","name":"20230219-add_astro_language"}
{"time":"2025-06-24T22:42:52.175904001Z","level":"INFO","msg":"potentially running migration","name":"20230219-add_subscription_renewal"}
{"time":"2025-06-24T22:42:52.176586618Z","level":"INFO","msg":"no need to migrate","name":"20230219-add_subscription_renewal"}
{"time":"2025-06-24T22:42:52.176659693Z","level":"INFO","msg":"potentially running migration","name":"20231023-fill_last_branch"}
{"time":"2025-06-24T22:42:52.177260175Z","level":"INFO","msg":"no need to migrate","name":"20231023-fill_last_branch"}
{"time":"2025-06-24T22:42:52.177273729Z","level":"INFO","msg":"potentially running migration","name":"20241220-share_activity_chart_flag"}
{"time":"2025-06-24T22:42:52.177827378Z","level":"INFO","msg":"no need to migrate","name":"20241220-share_activity_chart_flag"}
{"time":"2025-06-24T22:42:52.177899602Z","level":"INFO","msg":"potentially running migration","name":"20250219-update_heartbeats_timeout"}
{"time":"2025-06-24T22:42:52.178438273Z","level":"INFO","msg":"no need to migrate","name":"20250219-update_heartbeats_timeout"}
{"time":"2025-06-24T22:42:52.178451605Z","level":"INFO","msg":"potentially running migration","name":"20250313-fix_browsing_category"}
{"time":"2025-06-24T22:42:52.179205795Z","level":"INFO","msg":"no need to migrate","name":"20250313-fix_browsing_category"}
{"time":"2025-06-24T22:42:52.179318045Z","level":"INFO","msg":"creating job queue","name":"wakapi.processing","workers":1}
{"time":"2025-06-24T22:42:52.179396953Z","level":"INFO","msg":"creating job queue","name":"wakapi.default","workers":1}
{"time":"2025-06-24T22:42:52.179436888Z","level":"INFO","msg":"creating job queue","name":"wakapi.processing_2","workers":1}
{"time":"2025-06-24T22:42:52.179492012Z","level":"INFO","msg":"creating job queue","name":"wakapi.reports","workers":1}
{"time":"2025-06-24T22:42:52.179538071Z","level":"INFO","msg":"creating job queue","name":"wakapi.housekeeping","workers":1}
{"time":"2025-06-24T22:42:52.179572613Z","level":"INFO","msg":"creating job queue","name":"wakapi.mail","workers":1}
{"time":"2025-06-24T22:42:52.179703354Z","level":"INFO","msg":"scheduling summary aggregation"}
{"time":"2025-06-24T22:42:52.179968256Z","level":"INFO","msg":"creating job queue","name":"wakapi.imports","workers":1}
{"time":"2025-06-24T22:42:52.180140175Z","level":"INFO","msg":"scheduling report generation"}
{"time":"2025-06-24T22:42:52.180250217Z","level":"INFO","msg":"scheduling inactive users cleanup"}
{"time":"2025-06-24T22:42:52.180301482Z","level":"INFO","msg":"scheduling project stats cache pre-warming"}
{"time":"2025-06-24T22:42:52.18046709Z","level":"INFO","msg":"scheduling total time counting"}
{"time":"2025-06-24T22:42:52.180547109Z","level":"INFO","msg":"scheduling first data computing"}
{"time":"2025-06-24T22:42:52.184308295Z","level":"INFO","msg":"👉 Listening for HTTP... ✅","address":"0.0.0.0:3000"}

User exists:

app=# SELECT id, created_at, is_admin, has_data FROM users;
    id     |         created_at         | is_admin | has_data
-----------+----------------------------+----------+----------
 lrstanley | 2022-07-04 06:30:30.127645 | t        | t
(1 row)

For some reason, though, I can now login. I had reverted by DB back to a backup from 2.13.x, and re-applied, w/o issue. I had even tried restarting the service multiple times before when I was receiving the issue, with no change, so no idea why it's working now?

I guess I'll close? 😄

lrstanley avatar Jun 24 '25 23:06 lrstanley

Super strange! No idea how this happened, but yeah, glad things seem to be working again now 😃.

muety avatar Jun 26 '25 09:06 muety