Skip to content

Type with array property triggers error #836

@dargmuesli

Description

@dargmuesli

Summary

Custom types seem to result in an error when they contain an array property.

Steps to reproduce

Define a type like this:

CREATE TYPE public.jwt AS (
  ids UUID[]
);

Use it as column of some table:

CREATE TABLE public.token (
  token    public.jwt,
);

Query it like:

{
  allTokens {
    nodes {
      token
    }
  }
}

Expected results

No error in the console.

Actual results

Error: Internal graphile-build-pg error: should not attempt to tweak an array, please process array before tweaking (type: "pg_catalog._uuid")
    at Object.pgTweakFragmentForTypeAndModifier (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgTypesPlugin.js:300:23)
    at /postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgJWTPlugin.js:108:184
    at Array.map (<anonymous>)
    at pgTweaksByTypeId.<computed> (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgJWTPlugin.js:108:124)
    at Object.pgTweakFragmentForTypeAndModifier (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgTypesPlugin.js:257:16)
    at /postgraphile/node_modules/graphile-build-pg/node8plus/plugins/makeProcField.js:398:38
    at Object.<anonymous> (/postgraphile/node_modules/graphile-build-pg/node8plus/queryFromResolveDataFactory.js:90:5)
    at makeQuery (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/makeProcField.js:384:21)
    at resolve (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/makeProcField.js:567:25)
    at resolveField (/postgraphile/node_modules/graphql/execution/execute.js:464:18)

Error: Internal graphile-build-pg error: should not attempt to tweak an array, please process array before tweaking (type: "pg_catalog._uuid")
    at Object.pgTweakFragmentForTypeAndModifier (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgTypesPlugin.js:300:23)
    at /postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgJWTPlugin.js:108:184
    at Array.map (<anonymous>)
    at pgTweaksByTypeId.<computed> (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgJWTPlugin.js:108:124)
    at Object.pgTweakFragmentForTypeAndModifier (/postgraphile/node_modules/graphile-build-pg/node8plus/plugins/PgTypesPlugin.js:257:16)
    at /postgraphile/node_modules/graphile-build-pg/node8plus/plugins/pgField.js:44:143
    at callIfNecessary (/postgraphile/node_modules/graphile-build-pg/node8plus/QueryBuilder.js:24:12)
    at QueryBuilder.lock (/postgraphile/node_modules/graphile-build-pg/node8plus/QueryBuilder.js:740:22)
    at QueryBuilder.lockEverything (/postgraphile/node_modules/graphile-build-pg/node8plus/QueryBuilder.js:812:10)
    at QueryBuilder.build (/postgraphile/node_modules/graphile-build-pg/node8plus/QueryBuilder.js:617:10)

Additional context

Very similar issue: #669

Possible Solution

Something similar to #672 maybe

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions