moleculerjs / moleculer-apollo-server

:rocket: Apollo GraphQL server for Moleculer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrading to Apollo Server 3.x

abdavid opened this issue · comments

Are there plans in motion to upgrade to latest Apollo server?

One of the main breaking changes revolve around subscriptions being refactored out. The migration guide outlines a possible way to continue to support subscriptions through ws with a workaround, but also states that client would have to be adjusted accordingly to make it work as I understand it.

I did a quick refactor in my fork of this project to see how much would break, and while the subscription support has been removed and some of the exports from apollo-core-server has changed, I managed to get tests to pass (while still removing references to subscriptions though!)

Thinking ahead would it be feasible to create a new major version of this module, documenting the breaking changes so that those that require the subscription support can stay in 2.x land, while those who do not get the bright and shiny 3.x, and start paving the way for 3.x that will get subscription support at some point?

Thoughts? @icebob

Yeah, I saw the migration guide and I saw it contains a lot of breaking changes. By the way, would be good to upgrade to the latest Apollo Server but would be good for any help. Could you open a PR with your changes?

I would love to help out. Ill create a PR with my changes later today, would probably need to clean it up since I mostly just focused on finding the pieces that broke and getting the tests to pass.

@abdavid how is the progress from your side? Create a draft if you need hands

@icebob, Is there an update regarding this, or a projected timeline?

It's not in my timeline, but PR is accepted.

@icebob there is an existing PR, can it be merged?

Not yet, because the PR is not correct.

v3 officially deprecated

So, now should we skip v3 and try upgrading all deps to be compatible with v4?? @icebob How can I help??

@jbool24 please check this PR #118 (comment) It already contains some work re migration to v4

@AndreMaz @jbool24 Not really sure if it is worth migrating to v4, just a quick glance at #118 and checking out the code locally it is in a quite broken state. To me it looks like a large amount of work needed to migrate to v4 or v3 for that matter. For me it would look like we would need to create an ApolloServer plugin and use the addPlugin interface Apollo supplies. Also we need to consider that graphql-upload is not compatible with the project anymore considering that it is purely in mjs now.

I would argue that a re-implementation of graphql support for moleculer might be an easier approach. Also there has happened a lot with graphql. Like I mentioned before, adopting graphql yoga from The Guild could also improve some performance aspects while also improving DX.

Yoga repo: https://github.com/dotansimha/graphql-yoga
Yoga file upload: https://the-guild.dev/graphql/yoga-server/docs/features/file-uploads

I've also created a package which eliminates apollo server entirely in favor of graphql-tools. It needs some polish still but it's working. I don't have a timeline for doing the additional work, but I think this path is better than relying on Apollo server. https://github.com/shawnmcknight/moleculer-graphql

Thanks @shawnmcknight ! Ill test out replacing our current apollo variant with @shawnmcknight/moleculer-graphql 👍 as for this repo here, if someone really needs apollo I think they would be better off re-implementing this from scratch.

@shawnmcknight more or less a complete drop-in replacement, thanks for your awesome work. Though I get what you mean that it needs a little polish, some more optional types and more examples will go along way.