[Solved] Type Mutation must define one or more fields - compatibility issue with GraphQL 0.12.x

See original GitHub issue

I’m submitting a …

  • bug report
  • feature request
  • question

PostGraphQL version: 4.0.0-alpha2.30

Minimal SQL file that can be loaded into a clean database:


(Tried getting this via the --export-schema-graphql flag but got error Error: EISDIR: illegal operation on a directory, open {dir_path} with any directory I tried. However the postgres database uri I’m happy sharing is postgres://graphql:v26ppCS10u7aS68FJfY5EVqa9p6lVb@159.203.124.137:5431/core)

Steps to reproduce:

postgraphile -n 0.0.0.0 -s public -o -a -j -M --append-plugins /postgraphile-plugin-connection-filter/index.js --connection postgres://graphql:v26ppCS10u7aS68FJfY5EVqa9p6lVb@159.203.124.137:5431/core

Current behavior: Using tag -M when I load in the database I get no schema docs and for any query I run I get:

{
  "errors": [
    {
      "message": "Type Mutation must define one or more fields."
    }
  ]
}

Expected behavior: Get the schema docs just without any ability to run default mutations. Perhaps I misunderstand how the disable default mutations flag works though.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
angelosartocommented, Feb 12, 2018

Our current docker image also has to do a pin on a specific version. Check the Dockerfile in the root of postgraphql github.

Take a look at the sed script line. Based on your use case you will have to run this after your git clone but it should be similar

On Mon, Feb 12, 2018 at 10:41 AM Tyler van der Hoeven < notifications@github.com> wrote:

@benjie https://github.com/benjie So I’m building and running from a Docker so I’m not entirely sure how I’d do that. (I’m a Docker newbie)

FROM node:alpine

RUN apk add --update bash &&
apk add git &&
rm -rf /var/cache/apk/* &&
npm install -g postgraphile &&
git clone https://github.com/mattbretl/postgraphile-plugin-connection-filter.git

EXPOSE 5000 ENTRYPOINT [“postgraphile”, “-n”, “0.0.0.0”, “-s”, “public”, “-o”, “-a”, “-j”, “-M”, “–append-plugins”, “/postgraphile-plugin-connection-filter/index.js”]

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/postgraphql/postgraphql/issues/681#issuecomment-364982314, or mute the thread https://github.com/notifications/unsubscribe-auth/ABefi-VwSQgYWnqVaaYUC1Q4OIs8vDZ2ks5tUGnAgaJpZM4SBibV .

0reactions
benjiecommented, Mar 2, 2018

Yeah that wasn’t the solution in the end. I did a hack to fix it - look at the last 2 commits for this file:

https://github.com/graphile/postgraphile/commits/master/scripts/build

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Solved] Type Mutation must define one or more fields
[Solved] Type Mutation must define one or more fields - compatibility issue with GraphQL 0.12.x.
Read more >
UnhandledPromiseRejectionWar...
UnhandledPromiseRejectionWarning: Error: Type Query must define one or more fields. How can I declare an empty Query? graphql · apollo-server.
Read more >
GraphQL schema basics - Apollo GraphQL Docs
A single mutation operation can include multiple top-level fields of the Mutation type. This usually means that the operation will execute multiple back-end ......
Read more >
Working Draft - GraphQL Specification
All GraphQL operations must specify their selections down to fields which return scalar values to ensure an unambiguously shaped response.
Read more >
GraphQL API style guide - GitLab Docs
This field can only be resolved for one project in any single request. ... Developers should specify higher complexity for fields that cause...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found