© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•9mo ago•
4 replies
Carrot

419 error on login ONLY when session driver is "database"

After reading through the other posts involving 419 errors on Filament, I have not been able to resolve this issue.

When setting the session driver to
database
database
, I get a 419 error on logging in, but if I change it to
file
file
instead of
database
database
it works perfectly fine.

A few things: my users table uses
uuids
uuids
instead of an int, but I have updated the session table migration accordingly, migrated to a completely fresh database, and verified that the database connection works by using tinker to insert a new user into the database.

My migration:

public function up(): void
    {
        /* ... */
        Schema::create('users', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->foreignUuid('tenant_id')->nullable()->references('id')->on('tenants')->cascadeOnDelete();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });

        Schema::create('sessions', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->foreignUuid('user_id')->references('id')->on('users')->nullable()->index();
            $table->string('ip_address', 45)->nullable();
            $table->text('user_agent')->nullable();
            $table->longText('payload');
            $table->integer('last_activity')->index();
        });
        /* ... */
    }
public function up(): void
    {
        /* ... */
        Schema::create('users', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->foreignUuid('tenant_id')->nullable()->references('id')->on('tenants')->cascadeOnDelete();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });

        Schema::create('sessions', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->foreignUuid('user_id')->references('id')->on('users')->nullable()->index();
            $table->string('ip_address', 45)->nullable();
            $table->text('user_agent')->nullable();
            $table->longText('payload');
            $table->integer('last_activity')->index();
        });
        /* ... */
    }


my .env:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=atlas
DB_USERNAME=root
DB_PASSWORD=

SESSION_DRIVER=database
#SESSION_SECURE_COOKIE=true
#SESSION_COOKIE="atlas_session"
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=atlas
DB_USERNAME=root
DB_PASSWORD=

SESSION_DRIVER=database
#SESSION_SECURE_COOKIE=true
#SESSION_COOKIE="atlas_session"
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null


I have no idea why changing the session driver to database impacts it like this, but it's only when the driver is
database
database
, if I change it to
file
file
it works
Solution
sorry for the delay, I was working with a colleague on this, and we discovered that the session migration had the 'id' column set to 'uuid' instead of 'string' and that was throwing off everything, preventing the session from being stored properly, and then couldn't be retreived either.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

New install, 419 error on login
FilamentFFilament / ❓┊help
3y ago
Getting 419 status code on login
FilamentFFilament / ❓┊help
13mo ago
Filament + stancl/tenancy 419 error when login to tenant panel
FilamentFFilament / ❓┊help
8mo ago
Intermittently 419 error
FilamentFFilament / ❓┊help
3y ago