JWT Authorization Error: operator does not exist: uuid = integer
See original GitHub issueHasura Version: v1.0.0-alpha42
I am seeing the following error when trying to implement JWT Authorization:
detail: {
detail: {
error: {
code: "postgres-error"
error: "postgres query error"
internal: {
arguments: [0]
error: {
description: null
exec_status: "FatalError"
hint: "No operator matches the given name and argument types. You might need to add explicit type casts."
message: "operator does not exist: uuid = integer"
status_code: "42883"
}
prepared: true
statement: "SELECT coalesce(json_agg("root" ), '[]' ) AS "root" FROM (SELECT row_to_json((SELECT "_1_e" FROM (SELECT "_0_root.base"."created_on" AS "created_on", "_0_root.base"."owner_id" AS "owner_id", "_0_root.base"."tabletop_id" AS "tabletop_id", "_0_root.base"."tabletop_name" AS "tabletop_name", "_0_root.base"."updated_on" AS "updated_on" ) AS "_1_e" ) ) AS "root" FROM (SELECT * FROM "dt_public"."tabletop" WHERE ((("dt_public"."tabletop"."owner_id") = (((current_setting('hasura.user')::json->>'x-hasura-test'))::integer)) OR ((("dt_public"."tabletop"."owner_id") IS NULL) AND ((((current_setting('hasura.user')::json->>'x-hasura-test'))::integer) IS NULL))) ) AS "_0_root.base" ) AS "_2_root" "
}
path: "$"
}
request: "{"query":"{\n dt_public_tabletop {\n created_on\n owner_id\n tabletop_id\n tabletop_name\n updated_on\n }\n}\n","variables":null}"
}
The JWT contains the following claim:
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "user",
"X-Hasura-test": "adedb95e-47ad-43f5-b165-a9de4e406bd7",
"x-hasura-allowed-roles": [
"user"
]
},
My postgresql table schema is the following:
CREATE TABLE IF NOT EXISTS dt.dt_public.tabletop
(
tabletop_id uuid DEFAULT gen_random_uuid(),
tabletop_name VARCHAR(50) NOT NULL,
owner_id uuid NOT NULL
REFERENCES dt.dt_public.user (user_id)
ON DELETE CASCADE,
created_on TIMESTAMP NOT NULL,
updated_on TIMESTAMP NOT NULL,
PRIMARY KEY (tabletop_id)
);
I am trying to create a permissions that checks the incoming X-Hasura-test claim against the postgresql column owner_id which is of type uuid.
It appears that Hasura is casting the JWT claim as an integer instead of a string?
(((current_setting('hasura.user')::json->>'x-hasura-test'))::integer)
I am seeing this issue regardless of the key for the JWT claim i.e. X-Hasura-User-Id, X-Hasura-User-Uuid, X-Hasura-test, etc
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
SequelizeDatabaseError: operator does not exist uuid = integer
You should first check the models that you are including and their ID types. They must have same type. Beside that, let's say...
Read more >Micronaut Framework/questions - Gitter
How can I secure my ServerWebSocket with jwt authentication? ... PSQLException: ERROR: operator does not exist: uuid = character varying Hint: No operator ......
Read more >PostgreSQL connector | LoopBack Documentation
json file. If you create a PostgreSQL data source using the data source generator as described below, you don't have to do this,...
Read more >The JWT Handbook
There are pros and cons to any approach, and client-side sessions are not an ... access to the authorization server, most of the...
Read more >The Bitbucket Cloud REST API - Atlassian Developer
If your Atlassian Connect add-on uses JWT authentication, you can swap a JWT for an ... This scope alone does not give access...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The console may have picked them up (when you navigate to the table’s page in console) but the server needs to know that the schema has been modified on Postgres. Head to settings and hit ‘reload’.
@0x777 That solved the issue thank you!