Could not find the public.graphql(query, variables) function [pg_graphql] - TagMerge

Could not find the public.graphql(query, variables) function [pg_graphql]

rinshadkaAsked 5 months ago


We have tried the docker setup and successfully queried in GraphiQL. Then we tried using our existing database and installed the pg_graphql extension there. but while we try the GraphiQL it is returning error like below:-

  "hint": "If a new function was created in the database with this name and parameters, try reloading the schema cache.",
  "message": "Could not find the public.graphql(query, variables) function or the public.graphql function with a single unnamed json or jsonb parameter in the schema cache"


Source: link

oliriceAnswered 5 months ago

PostgREST caches your schema. Its telling you that that it didn't find the function you requested and you might need to reset the cache or restart the process.

More details here

If you're trying to use the existing dockerfile pointed at your own database, you'll also need to expose the graphql.resolve function in the public schema like this:

create function public.graphql(
    "operationName" text default null,
    query text default null,
    variables jsonb default null
    returns jsonb
    language sql
as $$
    select graphql.resolve(query, variables);
oliriceAnswered 5 months ago

did that resolve the issue?

oliriceAnswered 4 months ago

closing due to inactivity

Recent Issues

    Programming Languages