Comments (8)
Fixed in v1 π
from operation-hooks.
I think I got it working, this is either a workaround or it should be in the documentation:
So I added a very simply resolver for the subscription:
resolvers: {
CommunityFeedItemCommentSubscriptionPayload: {
async communityFeedItemComment(...args) {
return require('./resolver').default(sql, ...args); // eslint-disable-line global-require
},
},
Subscription: {
communityFeedItemCommentAdded: (event) => ({ event }),
},
},
The event needs to get passed through so we have access the to the subject
in the Payload resolver.
After that, everything seems to connect and work properly. Look aheads work, the query builder effectively does the look ahead and the resulting sql executed/produced seems accurate (based on looking at the query logs and debugging.
from operation-hooks.
@parris Can you confirm the order in which you're loading the pubsub and operationhooks plugins? I think you have to load pubsub first, then operation hooks.
from operation-hooks.
@benjie ahh - maybe that's it const pluginHook = makePluginHook([OperationHooks, PgPubsub, GraphilePro]);
from operation-hooks.
I was following the order found here https://www.graphile.org/postgraphile/plugins/ if I recall correctly. Perhaps the doc should get modified?
from operation-hooks.
@parris Can you confirm if this solved the issue? If so, a mod to the doc would be welcome π
from operation-hooks.
@benjie - I had a chance to look into this. Changing the order of the hooks does not impact this. In a fresh project (not using any other libraries between postgraphile and the codebase), and using mutations instead of subscriptions I've found the same thing to occur.
Example:
makeExtendSchemaPlugin(({ pgSql: sql }) => ({
typeDefs: gql`
type AuthenticationDetails {
person: Person!
jwtToken: String!
}
type RegisterPayload {
authenticationDetails: AuthenticationDetails!
}
`,
resolvers: {
RegisterPayload: {
async authenticationDetails(...args) {
return resolver.registerPerson(sql, ...args);
},
},
},
},
} as ExtensionDefinition)),
This will throw Error: Default resolver found for field Mutation.registerPerson; default resolvers at the root level are not supported by operation-hooks
However, even doing something as simple as the following resolves the issue.
Mutation: {
registerPerson: () => ({}),
}
from operation-hooks.
My guess is that things are running out of phase - operation hooks is trying to mod the resolver before itβs added by makeExtendSchemaPlugin. Iβm not sure what we can do about this in v4.
from operation-hooks.
Related Issues (11)
- Invocation of SQL functions should cast input param to JSONB, not JSON
- SQL operation hooks should be per-table
- Logic error: operation hook returned 'undefined' with Byid queries HOT 2
- error when requiring library HOT 1
- Allow messages to be registered from any SQL function HOT 6
- Question about the format of callback's 'input' argument HOT 3
- Question about operation hooks in JavaScript
- failed assertion at PgNoticeMessagesPlugin: "processNotice should not be set yet!" HOT 1
- Achive cookie with the help of graphile/operation-hooks HOT 1
- Access RAISE NOTICE details from GraphQL client HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from operation-hooks.