Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using sqlx postgres with axum-login #53

Open
martinrlilja opened this issue Sep 19, 2024 · 0 comments
Open

Error when using sqlx postgres with axum-login #53

martinrlilja opened this issue Sep 19, 2024 · 0 comments

Comments

@martinrlilja
Copy link

martinrlilja commented Sep 19, 2024

I'm not sure where is the best place for this issue.

I followed the sqlite example from axum-login, but replaced sqlite with tower-sessions-sqlx-store and postgres.

However I get this error when navigating to any page after sign in:

axum_login::service: could not create auth session from session err=invalid type: sequence, expected u8

I think it comes from the message pack decode, because when I run the session data in the database through online message pack decoders the auth_hash in axum-login.data is an array of arrays with a single number inside.

This is an example of the raw data in the database:

93c410030238e6944411151b0337b899fb099e81af6178756d2d6c6f67696e2e6461746182a9617574685f68617368dc001091a2313991a331303591a2363091a2383591a331323491a331353891a2373391a331323991a331363391a331303991a2383291a2353391a2323091a2353991a332343091a3313137a7757365725f6964d92431333639336335352d376339652d343938312d613336642d35323335313433626630373599cd07e8cd0111143a0dce35585b1a000000

Which gets decoded as:

[
  "AwI45pREERUbAze4mfsJng==",
  {
    "axum-login.data": {
      "auth_hash": [
        [
          "19"
        ],
        [
          "105"
        ],
        [
          "60"
        ]
...
    ]
  }
]

Switching from tower-sessions-sqlx-store to the built in MemoryStore fixes the problem.

Edit: swapping out rmp-serde for serde_json also fixes the problem. Sadly flexbuffers doesn't support i128.

@martinrlilja martinrlilja changed the title Error when using with axum-login Error when using sqlx postgres with axum-login Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant