As i can see, everything is fine - the table exists and there is correct token for the user that is making a request when using stancl multi-tenancy. Also, when i make a request to the database from console, the response is correct, for example - "select * from "personal_access_tokens" where "token" = 'token symbols'" returns the row. But once i make a request to any api endpoint that require authentication ('auth:sanctum'), it returns following error: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "personal_access_tokens" does not exist LINE 1: select * from "personal_access_tokens" where "token" = $1 i have no idea what does cause this, maybe somebody had the same problem?
Asked
Active
Viewed 1,073 times
0
-
This is likely to be related to my answer [here](https://stackoverflow.com/a/66261097/1091553]) and the tenancy not being initialized at the time Sanctum requests it (therefore the queries are run against your central database which gives you your table not found error). – Rory Mar 11 '21 at 19:43