question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to use Postgraphile as a graphql datasource

See original GitHub issue

Bug description

an error occurred and the code could not be generated

only working with option --skip-plugins graphile-build:NodePlugin

How to reproduce

run postgrapgphile

postgraphile -c 'postgres://storeo:storeo@localhost:5433/storeo' --watch --enhance-graphiql --dynamic-json

setup datasource wundergraph.config.ts

const postgraphile = introspect.graphql({
    apiNamespace: 'pg',
    url: 'http://localhost:5000/graphql'
})

const myApplication = new Application({
    name: 'app',
    apis: [
        postgraphile
    ],
});

run wunderctl

wunderctl generate  --env .env

error

2:58:38 PM: wundergraph.app.schema.graphql updated
Error: Interface field pg_Node.nodeId expected but Query does not provide it.
    at assertValidSchema (/home/minhdtb/projects/storeo/storeo-backend/node_modules/graphql/type/validate.js:59:11)
    at validate (/home/minhdtb/projects/storeo/storeo-backend/node_modules/graphql/validation/validate.js:63:35)
    at Object.enter (/home/minhdtb/projects/storeo/storeo-backend/node_modules/@wundergraph/sdk/dist/graphql/operations.js:47:59)
    at visit (/home/minhdtb/projects/storeo/storeo-backend/node_modules/graphql/language/visitor.js:197:21)
    at parseOperations (/home/minhdtb/projects/storeo/storeo-backend/node_modules/@wundergraph/sdk/dist/graphql/operations.js:30:29)
    at /home/minhdtb/projects/storeo/storeo-backend/node_modules/@wundergraph/sdk/dist/configure/index.js:350:61
    at processTicksAndRejections (node:internal/process/task_queues:96:5)





--->
No Operations found! Please create at least one Operation in the directory ./operations
Operation files must have the file extension '.graphql', otherwise they are ignored.
Operations don't need to be named, the file name is responsible for the operation name.
<---

Expected behavior

working as expected

WunderGraph information

N/A

Environment & setup

OS: Ubuntu Go version: go1.17.2 linux/amd64 Database: PostgreSQL Node.js version: v16.15.1

WunderCtl Version

Version: 0.90.32
Commit: 386a3d4b66204411dc89da6919aad0bebe524657
Date: 2022-06-06T12:21:43Z
BuiltBy: ci

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jensneusecommented, Jul 9, 2022

@jensneuse I want to use custom query feature of postgraphile by using plpgsql function. So I used postgraphile as a datasource. Currently, if postgraphile’s custom query returns a JSON data type, wundergraph won’t get it. According to the document here url, I see that replaceJSONTypeFields only support db datasource, I think this feature is needed for graphql datasource as well

That’s great feedback. I think it makes sense to add this feature to all data sources.

1reaction
minhdtbcommented, Jul 9, 2022

@jensneuse I want to use custom query feature of postgraphile by using plpgsql function. So I used postgraphile as a datasource. Currently, if postgraphile’s custom query returns a JSON data type, wundergraph won’t get it. According to the document here url, I see that replaceJSONTypeFields only support db datasource, I think this feature is needed for graphql datasource as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using PostGraphile as a Library
Utilities to build powerful and performant GraphQL APIs.
Read more >
Five Common Problems in GraphQL Apps (And How to Fix ...
Solution: GraphQL Schema Generation. A number of solutions to this problem have emerged in the GraphQL ecosystem. For example, PostGraphile ...
Read more >
GraphQL API: Integration with PostGraphile [Full-stack Tutorial ...
Using PostGraphile to Integrate with GraphQL; GraphQL Playground; GraphQL API ... “Failed to setup watch fixtures in Postgres database” ...
Read more >
PostgreSQL / PostGraphile – GraphQL Mesh
This handler allows you to use the GraphQL schema created by ... out our example that uses schema stitching with a PostgreSQL data...
Read more >
Creating an authenticated GraphQL API with PostGraphile
Overview In this blog post we will look at how to create a GraphQL API over our PostgreSQL database and how to secure...
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