fix: Expunge notification objects from the session and add robust JSO…#254
Merged
pwei1018 merged 1 commit intobcgov:mainfrom Feb 17, 2026
Merged
fix: Expunge notification objects from the session and add robust JSO…#254pwei1018 merged 1 commit intobcgov:mainfrom
pwei1018 merged 1 commit intobcgov:mainfrom
Conversation
…N serialization to prevent ObjectDeletedError.
bolyachevets
approved these changes
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix error:
File "/code/.venv/lib/python3.12/site-packages/flask/app.py", line 917, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/flask/app.py", line 902, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/flask_jwt_oidc/jwt_manager.py", line 273, in decorated
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/flask_jwt_oidc/jwt_manager.py", line 226, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/flask_pydantic/core.py", line 285, in wrapper
res = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/code/src/notify_api/resources/v1/notify.py", line 38, in send_notification
return jsonify(notification.json), HTTPStatus.OK
^^^^^^^^^^^^^^^^^
File "/code/src/notify_api/models/notification.py", line 118, in json
"id": self.id,
^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/sqlalchemy/orm/attributes.py", line 569, in get
return self.impl.get(state, dict_) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/sqlalchemy/orm/attributes.py", line 1096, in get
value = self._fire_loader_callables(state, key, passive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/sqlalchemy/orm/attributes.py", line 1126, in _fire_loader_callables
return state._load_expired(state, passive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/sqlalchemy/orm/state.py", line 803, in _load_expired
self.manager.expired_attribute_loader(self, toload, passive)
File "/code/.venv/lib/python3.12/site-packages/sqlalchemy/orm/loading.py", line 1682, in load_scalar_attributes
raise orm_exc.ObjectDeletedError(state)
sqlalchemy.orm.exc.ObjectDeletedError: Instance '<Notification at 0x7f8e6c2c39e0>' has been deleted, or its row is otherwise not present.
}