canvas icon indicating copy to clipboard operation
canvas copied to clipboard

Laravel 11 | Warning 1265 Data truncated for 'user_id'

Open levaweb opened this issue 1 year ago • 7 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

When I access the login page I get error 500 below. https://www.example.com/canvas/login

Note: 'sessions.user_id' is a bigint (20)

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'user_id' at row 1 (Connection: mysql, SQL: update sessionssetpayload= YTo0OntzOjY6Il90b2tlbiI7czo0MDoiZmtGMWs3RUdsVEJVY3VESmRXTzRLUDVYMlliM3dIeGJ1Q0Z5NGxNeiI7czo5OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MzI6Imh0dHBzOi8vd3d3LmtsYXlyaXZlci5jb20vY2FudmFzIjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo1MzoibG9naW5fY2FudmFzXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO3M6MzY6IjkwOGIzNGIxLTZkYWEtNGYxMC1iYWI5LWE1NWI4NjM0NTNlYyI7fQ==,last_activity= 1718115707,user_id= 908b34b1-6daa-4f10-bab9-a55b863453ec,ip_address= 84.71.26.63,user_agent= Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 OPR/110.0.0.0 whereid = b46ZFoRfsccM5IIvvGJhHBQOK3DYpHWDIhTxAyqm)

Expected Behavior

I expected the home page to load.

Steps To Reproduce

I've installed laravel 11 on my live server (no jetstream), then:

cd /laravel
composer require austintoddj/canvas
php artisan canvas:install   
 // got login credentials
 email: [email protected]  psw: password
php artisan storage:link

Environment

php 8.2
laravel 11
Ubuntu 22.04
Canvas: latest (6.0.54)

Anything else?

Please help, thanks.

https://github.com/austintoddj/canvas/discussions/1094 https://github.com/austintoddj/canvas/issues/851

levaweb avatar Jun 11 '24 14:06 levaweb

Just create a new migration

public function up(): void { Schema::table('sessions', function (Blueprint $table) { $table->string('user_id', length: 255)->change()->nullable(); }); }

kusman28 avatar Jul 23 '24 18:07 kusman28

+1 this breaks on new installs

phil-hudson avatar Aug 01 '24 05:08 phil-hudson

+1 this breaks on new installs

Have u tried my solution? https://github.com/austintoddj/canvas/issues/1431#issuecomment-2245970944

kusman28 avatar Aug 01 '24 05:08 kusman28

yep but it likely needs to be addressed in the package itself

phil-hudson avatar Aug 01 '24 05:08 phil-hudson

The solution: changing the users table $table->foreignID('user_id')->nullable()->index(); to $table->uuid('user_id')->nullable()->index();

Worked for me

naxis avatar Aug 19 '24 02:08 naxis

This looks like a similar issue to #851 and #1022. @alex32 are you using a file session driver or DB?

austintoddj avatar Aug 26 '24 13:08 austintoddj

in my case, I have users table and canvas creates canvas_users table as well.

ahmed-alii avatar Apr 15 '25 07:04 ahmed-alii