REST Data Source on Type Resolver #6015
Replies: 2 comments 2 replies
-
Seems like this is a known issue #1526 that has yet to be resolved. Any traction on this? |
Beta Was this translation helpful? Give feedback.
-
Apollo Server does not currently support subscriptions. (Older versions supported them superficially; the superficial nature led to issues like this one.) There is documentation for using subscriptions-transport-ws in your server alongside Apollo Server (which soon will be rewritten to suggest the more maintained graphql-ws) but if that software doesn't support setting up data sources then it won't work. The data sources API is pretty simple so it should be straightforward to set up a REST data source in that software's equivalent of "context". (We do hope to have integrated support for subscriptions in the future.) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm running into an error that reads as follows and was wondering if anyone here could offer some support:
[GraphQL error]: Message: Cannot read property 'userApi' of undefined, Location: [{"line":9,"column":5}], Path: actionAdded,user_tx
I have my resolvers set up as such:
The Action resolver type here uses my dataSources and throws the error listed above. However, in my query resolvers the userApi works just fine. Am I missing something? Are REST Data Sources not made available to Field Resolvers that are returning from a subscription?
For example I looked at the types made available and they look like they provide a Context param type so I would think that perhaps the issue is that REST DataSources aren't instantiated prior to the Field resolvers since the following doesn't throw a syntax error:
Perhaps the REST Data Source doesn't call the
Initialize
function prior to field resolvers that are returning from a subscription?@glasser, @hwillson Do you either of you maybe know if REST Data Sources can be used with Field Resolvers that are returning from a subscription?
Beta Was this translation helpful? Give feedback.
All reactions