You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constclaims='{"role":"authenticated","sub":"8609034g-e897-4631-ad07-15d3ebdd7999"}'constdata=awaitsql.begin('ISOLATION LEVEL SERIALIZABLE',async(sql)=>{awaitsql`SET session role authenticated`awaitsql`SET request.jwt.claims TO ${claims}`// <-- this breaksconstchanged=awaitsql`SELECT id, message FROM test`returnchanged})
I tried every variation I could think off to insert the sub claim into my query, but it always results in the error PostgresError: syntax error at or near "$1".
I also tried using sql.json which resulted in PostgresError: invalid input syntax for type json
I also tried inlining the json in the request directly and only passing the sub value via interpolation, but that failed as well.
The text was updated successfully, but these errors were encountered:
Use the set_config and current_setting functions instead, as they support parameters 😉 Be sure to set the is_local value correctly (should most likely be true always)!
I have a query that looks like this:
I tried every variation I could think off to insert the
sub
claim into my query, but it always results in the errorPostgresError: syntax error at or near "$1"
.I also tried using
sql.json
which resulted inPostgresError: invalid input syntax for type json
I also tried inlining the json in the request directly and only passing the sub value via interpolation, but that failed as well.
The text was updated successfully, but these errors were encountered: