Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to use Postgraphile as a graphql datasource #46

Closed
minhdtb opened this issue Jun 21, 2022 · 9 comments
Closed

Failed to use Postgraphile as a graphql datasource #46

minhdtb opened this issue Jun 21, 2022 · 9 comments
Labels
bug Something isn't working meta: stale

Comments

@minhdtb
Copy link

minhdtb commented Jun 21, 2022

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

@minhdtb minhdtb added the bug Something isn't working label Jun 21, 2022
@jensneuse
Copy link
Member

I think we should build a postgraphile example and figure out the issues you're facing here. I know there are a few quirks with graphile and the Node interface, but it's solveable.

@abdelhameedhamdy
Copy link
Contributor

I already used postgraphile with WG few months ago without issue.

@minhdtb
Copy link
Author

minhdtb commented Jun 24, 2022

@abdelhameedhamdy Could you share some sample? I have tried the latest version but still not working. And the postgraphile subscriptions feature also doesn't work even with the option -skip-plugins graphile-build:NodePlugin

@abdelhameedhamdy
Copy link
Contributor

@abdelhameedhamdy Could you share some sample? I have tried the latest version but still not working. And the postgraphile subscriptions feature also doesn't work even with the option -skip-plugins graphile-build:NodePlugin

Sorry for late reply, it just works as you did, postgraphile endpoint exposed from cli, url endpoint data source is added in WG config file, simple as that.
I don't recall the used WG version.

@jensneuse
Copy link
Member

@minhdtb as an alternative, could you directly connect to PostgreSQL using introspect.postgres?

@minhdtb
Copy link
Author

minhdtb commented 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

@jensneuse
Copy link
Member

@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.

@stale
Copy link

stale bot commented Sep 7, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale label Sep 7, 2022
@stale stale bot closed this as completed Sep 17, 2022
@Knorway
Copy link

Knorway commented Dec 14, 2022

I'm having the same issue with integrating postgraphile and really hope to use wundergraph with it. is there any plan to solve this if i may ask?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working meta: stale
Projects
None yet
Development

No branches or pull requests

4 participants