dgcam
05/16/2018, 7:49 PMinvalid input syntax for type boolean
which is a postgres 22P02
error. This happens when calling current_setting('jwt', true)
from an unauthenticated session (i.e. no jwt exists). I’ve worked around the issue by adding an exception handler in the trigger, which is ok given this path is called very infrequently.
However I want to understand this more to ensure this isn’t an indicator of a larger problem.
This is reproducible with the following steps
1) login our app (creating a valid jwt)
2) logout of the app (the app deletes the auth header and calls resetStore
)
3) Immediately trigger the unauthenticated path with a call to the mutation
In this case, the trigger which works as expected in all other cases, throws the exception that the boolean call to current_setting is invalid.
After enabling PG logging, it appears the issue only reproduces if an authenticated user logs out and issues the mutation before postgraphile calls LOG: statement: SELECT name, setting FROM pg_settings WHERE source = 'session';
Per the PG docs, a current_setting(<var>, <true|false>)
should always work. I’m wondering if there is a race between postgraphile reseting some local/connection state and PG current_setting() implementation.
Any Thoughts/Ideas/Tips?lawjolla
05/16/2018, 8:02 PMdgcam
05/16/2018, 8:07 PM