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

Invalid text representation: canvas_users:id -> sessions:user_id #1427

Open
1 task done
scrappy opened this issue May 11, 2024 · 2 comments
Open
1 task done

Invalid text representation: canvas_users:id -> sessions:user_id #1427

scrappy opened this issue May 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@scrappy
Copy link

scrappy commented May 11, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "7f3aeeeb-ec17-42d2-95c9-dfd777c65cea" CONTEXT: unnamed portal parameter $3 = '...'

Looking at the database, the session table has user_id defined as bigint, same as the users table .. but canvas_users has id set as UUID ...

`

\d sessions

                     Table "public.sessions"
Column     |          Type          | Collation | Nullable | Default

---------------+------------------------+-----------+----------+---------
id | character varying(255) | | not null |
user_id | bigint | | |
ip_address | character varying(45) | | |
user_agent | text | | |
payload | text | | not null |
last_activity | integer | | not null |
Indexes:
"sessions_pkey" PRIMARY KEY, btree (id)
"sessions_last_activity_index" btree (last_activity)
"sessions_user_id_index" btree (user_id)
`

Database backend is PostgreSQL ... from git, doesn't look like canvas' schema has changed in 4 years, so did something change in newer laravel ... ?

Expected Behavior

No response

Steps To Reproduce

Install canvas on top of laravel 11.7.0 and try and login.

Fresh install of both as of today, using composer to install ...

Environment

> php artisan --version
Laravel Framework 11.7.0

Anything else?

No response

@scrappy scrappy added the bug Something isn't working label May 11, 2024
@scrappy
Copy link
Author

scrappy commented May 11, 2024

To get around the issue, I just changed my session settings to use redis instead of database ... doesn't fix the issue, but suspect moving to redis is probably a good idea to start with ...

@mdrisss
Copy link

mdrisss commented May 27, 2024

By default, the migration file for the sessions table comes with the line : $table->foreignId('user_id')->nullable()->index();
I've changed this line to this: $table->uuid('user_id')->nullable()->index();
It remains to be seen whether this is a good solution, but it gets around the problem :)

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
None yet
Development

No branches or pull requests

2 participants