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

Problem persisting session data to database #2339

Closed
dirk-de-pauw opened this issue Apr 29, 2020 · 0 comments · Fixed by #2347
Closed

Problem persisting session data to database #2339

dirk-de-pauw opened this issue Apr 29, 2020 · 0 comments · Fixed by #2347
Labels
bug Something isn't working
Projects

Comments

@dirk-de-pauw
Copy link

I'm having problems persisting my session data in a MySQL database.

Steps to reproduce

When I use this in configure.swift:

app.sessions.use( .fluent( .mysql ) )
app.middleware.use( app.sessions.middleware )
app.migrations.add( SessionRecord.migration )

it doesn't work. It only works when app.sessions.use( .memory ) is used. But then the in-memory storage is used. By the way, the migration works and the tables are created in the database.

Expected behavior

Session data should get stored in the database table when for example this request.session.data[ "userID" ] = loginResponse.id.uuidString is used.

Actual behavior

Nothing happens. Nothing is saved to the database table and no error is reported.

Fix

Browser cookies had to be cleared. Then it started storing the data in the database.

Environment

  • Vapor Framework version: 4
  • Vapor Toolbox version: 3.1.10
  • OS version: macOS
@tanner0101 tanner0101 added the bug Something isn't working label May 6, 2020
@tanner0101 tanner0101 added this to To Do in Vapor 4 via automation May 6, 2020
Vapor 4 automation moved this from To Do to Done May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Vapor 4
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants