Closed AaronNGray closed 5 months ago
Looking at https://github.com/dotansimha/graphql-yoga/blob/main/packages/subscription/src/create-pub-sub.ts#L36 and https://github.com/apollographql/graphql-subscriptions/blob/master/src/pubsub.ts#L8 subscription methods it might need an adapter for supporting both ?
type-graphql@1.1.1
used to support graphql-subscriptions@2.0.0
right out of the box. But type-graphql@2.0.0-beta.1
does not seem to anymore. The problem seems to be there is no type-graphql@2.0.0-beta.1
tag on this repo. So I cannot see what is going wrong here and why it used to work ?
I will produce a general example with type-graphql@1.1.1 and graphql-subscriptions@2.0.0 and another with type-graphql@2.0.0-beta.1 (the one that used to work, and try this with my working node_modules zip) and another with type-graphql@2.0.0-beta.4.
@MichalLytek - It looks to me like you v2.0.0's should really be either a type-graphql-yoga
or a type-graphql-apollo
or the straight type-graphql
should still work with graphql-subscriptions
, or there should be adapters, or an adaptive typing and calling ?
Okay, it looks like you overwrote/republished the NPM type-graphql@2.0.0-beta.1
with a different distribution. This broke my code the old one is based on graphql-subscription
the newer one on @yoga/subscription
. To verify this I copied the type-graphql
from my working old test repo to another one freshly npm install
'ed and that one started working.
Right okay type-graphql@2.0.0-beta.3
uses graphql-subscriptions@2.0.0
again and works with a cast resolvers
to NonEmptyArray
!!
Okay I can hopefully move forward with this now, but please bear in mind my previous comments above.
graphql-subscriptions
are outdated and should not be used anymore. Neither internally by TypeGraphQL, nor by your code.
Migration to yoga pubsub, even with redis event target are really easy and should be favored instead of writing adapter for sticking with old graphql-subscriptions
package.
I am getting the following issue with both 2.0.0-beta.1 and 2.0.0-beta.4
Only the beta 4 uses the new yoga-based subscriptions.
@MichalLytek - Usage of graphql-subscriptions against @graphql-yoga/subscription :- https://npmcharts.com/compare/graphql-subscriptions,@graphql-yoga/subscription?interval=30 https://npmcharts.com/compare/graphql-subscriptions,@graphql-yoga/subscription?interval=120
i guess the issue comes from the fact that, an npm package with a version was overwritten/republished, but the npm version was not increased, (in my case type-graphql@2.0.0-beta.3) , which broke code that was already working.
This is not possible in npm. You can only unlist selected version in 24h after publishing and there's no way to republish it then, not mentioning overriding with other package data.
Closing this one as in beta 6 there's a change in subscription lib and should be no more issues with types, etc.
@MichalLytek - Do I still have support for graphql-subscriptions ? Or do I have to folk ?
I have two examples I would like to have them both work :-
https://github.com/AaronNGray/vite-js-apollo-v4-graph-ws-subscription-ssl-example https://github.com/AaronNGray/vite-js-apollo-v4-graph-ws-yoga-subscription-example
graphql-subscriptions
can work if you write an adapter for the new PubSub
interface.
However, it makes no sense to still use graphql-subscriptions
as migrating to yoga subscription or other solution you find is quite easy. I did it in examples and tests while changing the core.
https://typegraphql.com/docs/next/migration-guide.html#subscriptions
Describe the Bug I am getting the following issue with both 2.0.0-beta.1 and 2.0.0-beta.4
I managed to solve the issue and had a working solution, but on retrying the solution the package-lock.json did not seem to manage to save the solution !!!
TypeScript compile time error :-
non yoga based.
To Reproduce A quick guide how to reproduce the bug. You can paste here code snippets or even better, provide a link to the repository with minimal reproducible code example.
I will provide a working and non working examples tomorrow. I will probably have to whittle the main code down and zip everything up including the node_modules directory for the working version as the package-lock.json file does not seem to be working !
Expected Behavior A clear and concise description of what you expected to happen.
@apollo/server@4.9.5 v @apollo/server@4.10.0 + type-graphql@2.0.0-beta.4 v graphql-subscriptions@2.0.0 type system to be consistent
Logs If applicable, add some console logs to help explain your problem. You can paste the errors with stack trace that were printed when the error occurred.
Environment (please complete the following information):
Additional Context npm ls -all working apollo-v4-server.ls.npm.txt not working apollo-v4-check-server.ls.npm.txt
Add any other context about the problem here.