We’ve been using postgraphile (v3) for about 4 mon...
# orm-help
d
We’ve been using postgraphile (v3) for about 4 months and have recently run into an issue. After googling around a bit, the problem has been seen sporadically on several different frameworks without any real solution/replies. The issue: Occasionally, a trigger on a PG table will fail with an exception
invalid 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?
l
I don't think too many people here are working with Postgraphile. Do they have a slack room?
d
They have a gitter and I’m posting there as well. I thought I’d try here as well just in case someone was using. Thanks for the tip though!
👍 1