Skip to content

Bug: (AsyncWS) connection.new_session() fails because it stores old JWT token #355

Description

@cerasusK

Describe the bug

I also described the behaviour here: surrealdb/docs.surrealdb.com#1958

the connection object stores the last session's JWT and on attempting to create a .new_session() a surrealdb.errors.NotAllowedError: The token has expired is raised because it automatically tries to authenticate with the existing token, even if its not desired. So if I want to signin on a new session, I cannot because the JWT prevents the session from being created

Steps to reproduce

database_connection = AsyncWsSurrealConnection(f"ws://{ip}:{port}/rpc")
#create a new session, signin on session
#wait for session JWT to expire
database_connection.new_session() #exception raised

Expected behaviour

the exception to not be raised, a new session created

Workaround: catch NotAllowedError and call connection.invalidate()

SurrealDB version

3.1.5

surrealdb.py version

3.0 beta7

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct for repository surrealdb/surrealdb.py

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions