-
Notifications
You must be signed in to change notification settings - Fork 7
Description
In the endpoint to create a new session POST /session there is logic to transfer relevant data from an existing session to a new one.
This does not work and no data is transferred to the new session.
The reason is that the SessionManager.get_session method will trigger a destroyal of the old session and raises a SessionNotFoundError if a session has expired.
fmu-settings-api/src/fmu_settings_api/session.py
Lines 201 to 203 in b419ce8
| if session.expires_at < now: | |
| await self.destroy_session(session_id) | |
| raise SessionNotFoundError("Invalid or expired session") |
Hence the exception here is suppressed and the old_session variable is never defined and stays None. The old_session value is used in turn to check if data should be transferred.
fmu-settings-api/src/fmu_settings_api/v1/routes/session.py
Lines 70 to 74 in b419ce8
| if fmu_settings_session: | |
| with contextlib.suppress(Exception): | |
| old_session = await session_manager.get_session( | |
| fmu_settings_session, extend_expiration=False | |
| ) |
Existing tests does not pick up on it since we are testing to transfer data between a non-expired session to a new one, hence we do not trigger the SessionNotFoundError.