graphile/operation-hooks

Logic error: operation hook returned 'undefined' with Byid queries

dgkm opened this issue · 2 comments

dgkm commented

We are getting an error "Logic error: operation hook returned 'undefined'." when no record found with any "*ById" query on any table.

This error seems to be coming from "graphql/oprational-hooks".

Environment to reproduce the issue:

  • run the postgraphile with the following hooks:
    makePluginHook([OperationHooks, PgPubsub, subscriptionsLds]);
  • execute *ById query on any table passing non existing record *id to reproduce the error

Example to reproduce:

Table:

CREATE TABLE account ( "id" serial primary key, "firstName" text, "lastName" text, "dateOfBirth" date, "createdAt" timestamptz not null default now(), "updatedAt" timestamptz not null default now() )

Sample Request:

Note: Any non existing record id, example id = 10, a non existing record.

{ accountById(id: 10) { id } }

Sample Response:

{ "errors": [ { "message": "Logic error: operation hook returned 'undefined'.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "accountById" ], "extensions": { "messages": [] } } ], "data": { "accountById": null } }

@benjie, Please let me know if you need any further information to reproduce the issue.

Hitting this issue as well.

This is fixed in @graphile/operation-hooks@0.2.4 👍