-
-
Notifications
You must be signed in to change notification settings - Fork 171
Open
Description
Describe the bug
Clicking Create API Key does not create a key and causes an error according to the logs
Screenshots
If applicable, add screenshots to help explain your problem.
Logs
If applicable, add logs to help explain your problem
2026-03-14T08:38:53.264286727Z
2026-03-14T08:38:53.264288760Z During handling of the above exception, another exception occurred:
2026-03-14T08:38:53.264306249Z
2026-03-14T08:38:53.264308279Z Traceback (most recent call last):
2026-03-14T08:38:53.264310328Z File "/app/.venv/lib/python3.13/site-packages/gunicorn/workers/sync.py", line 142, in handle
2026-03-14T08:38:53.264312474Z self.handle_request(listener, req, client, addr)
2026-03-14T08:38:53.264314505Z ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-14T08:38:53.264316525Z File "/app/.venv/lib/python3.13/site-packages/gunicorn/workers/sync.py", line 185, in handle_request
2026-03-14T08:38:53.264318644Z respiter = self.wsgi(environ, resp.start_response)
2026-03-14T08:38:53.264320725Z File "/app/.venv/lib/python3.13/site-packages/flask/app.py", line 1536, in __call__
2026-03-14T08:38:53.264325975Z return self.wsgi_app(environ, start_response)
2026-03-14T08:38:53.264328559Z ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-14T08:38:53.264331645Z File "/app/.venv/lib/python3.13/site-packages/flask/app.py", line 1514, in wsgi_app
2026-03-14T08:38:53.264334851Z response = self.handle_exception(e)
2026-03-14T08:38:53.264337046Z File "/app/.venv/lib/python3.13/site-packages/flask_restx/api.py", line 677, in error_router
2026-03-14T08:38:53.264339230Z return original_handler(e)
2026-03-14T08:38:53.264341253Z File "/app/.venv/lib/python3.13/site-packages/flask/app.py", line 860, in handle_exception
2026-03-14T08:38:53.264343377Z server_error = self.ensure_sync(handler)(server_error)
2026-03-14T08:38:53.264345441Z File "/app/app/error_handlers.py", line 11, in error_500
2026-03-14T08:38:53.264347555Z return render_template("error/500.html"), 500
2026-03-14T08:38:53.264349682Z ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
2026-03-14T08:38:53.264352010Z File "/app/.venv/lib/python3.13/site-packages/flask/templating.py", line 151, in render_template
2026-03-14T08:38:53.264354239Z return _render(app, template, context)
2026-03-14T08:38:53.264356242Z File "/app/.venv/lib/python3.13/site-packages/flask/templating.py", line 128, in _render
2026-03-14T08:38:53.264358344Z app.update_template_context(context)
2026-03-14T08:38:53.264360361Z ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
2026-03-14T08:38:53.264362405Z File "/app/.venv/lib/python3.13/site-packages/flask/app.py", line 530, in update_template_context
2026-03-14T08:38:53.264364544Z context.update(self.ensure_sync(func)())
2026-03-14T08:38:53.264366557Z ~~~~~~~~~~~~~~~~~~~~~~^^
2026-03-14T08:38:53.264368580Z File "/app/app/context_processors.py", line 11, in inject_server_name
2026-03-14T08:38:53.264370704Z setting = Settings.query.filter_by(key="server_name").first()
2026-03-14T08:38:53.264372828Z File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/orm/query.py", line 2759, in first
2026-03-14T08:38:53.264374981Z return self.limit(1)._iter().first() # type: ignore
2026-03-14T08:38:53.264377014Z ~~~~~~~~~~~~~~~~~~~^^
2026-03-14T08:38:53.264379071Z File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/orm/query.py", line 2857, in _iter
2026-03-14T08:38:53.264381192Z result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
2026-03-14T08:38:53.264383257Z ~~~~~~~~~~~~~~~~~~~~^
2026-03-14T08:38:53.264385297Z statement,
2026-03-14T08:38:53.264387313Z ^^^^^^^^^^
2026-03-14T08:38:53.264389327Z params,
2026-03-14T08:38:53.264391323Z ^^^^^^^
2026-03-14T08:38:53.264393336Z execution_options={"_sa_orm_load_options": self.load_options},
2026-03-14T08:38:53.264397468Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-14T08:38:53.264399598Z )
2026-03-14T08:38:53.264401574Z ^
2026-03-14T08:38:53.264404200Z File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 2351, in execute
2026-03-14T08:38:53.264407660Z return self._execute_internal(
2026-03-14T08:38:53.264410563Z ~~~~~~~~~~~~~~~~~~~~~~^
2026-03-14T08:38:53.264412660Z statement,
2026-03-14T08:38:53.264414672Z ^^^^^^^^^^
2026-03-14T08:38:53.264416711Z ...<4 lines>...
2026-03-14T08:38:53.264418750Z _add_event=_add_event,
2026-03-14T08:38:53.264420751Z ^^^^^^^^^^^^^^^^^^^^^^
2026-03-14T08:38:53.264422745Z )
2026-03-14T08:38:53.264424704Z ^
2026-03-14T08:38:53.264426702Z File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 2239, in _execute_internal
2026-03-14T08:38:53.264428849Z conn = self._connection_for_bind(bind)
2026-03-14T08:38:53.264430924Z File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 2108, in _connection_for_bind
2026-03-14T08:38:53.264433100Z return trans._connection_for_bind(engine, execution_options)
2026-03-14T08:38:53.264435154Z ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-14T08:38:53.264437198Z File "<string>", line 2, in _connection_for_bind
2026-03-14T08:38:53.264439706Z File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/orm/state_changes.py", line 101, in _go
2026-03-14T08:38:53.264441898Z self._raise_for_prerequisite_state(fn.__name__, current_state)
2026-03-14T08:38:53.264443935Z ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-14T08:38:53.264445977Z File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py", line 971, in _raise_for_prerequisite_state
2026-03-14T08:38:53.264448138Z raise sa_exc.PendingRollbackError(
2026-03-14T08:38:53.264450185Z ...<6 lines>...
2026-03-14T08:38:53.264452235Z )
2026-03-14T08:38:53.264454258Z sqlalchemy.exc.PendingRollbackError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (sqlite3.IntegrityError) FOREIGN KEY constraint failed
2026-03-14T08:38:53.264456610Z [SQL: INSERT INTO api_key (name, key_hash, created_at, last_used_at, created_by_id, is_active) VALUES (?, ?, ?, ?, ?, ?)]
2026-03-14T08:38:53.264458747Z [parameters: ('TestAPI', '98e5e39cc9d93cd779c027f77bde4590ba0f07e232621d053b7cd1bb51e1e274', '2026-03-14 08:38:53.246680', None, 'admin', 1)]
2026-03-14T08:38:53.264460903Z (Background on this error at: https://sqlalche.me/e/20/gkpj) (Background on this error at: https://sqlalche.me/e/20/7s2a)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels