birkir / prime

✨Open Source GraphQL CMS
https://docs.primecms.app
MIT License
1.72k stars 112 forks source link

Updated apollo-server-express version breaks schema assignment. #329

Open joaovpmamede opened 4 years ago

joaovpmamede commented 4 years ago

I had issues running master with a project that was built with the latest npm released version (v0.3.4-beta.1). After a couple of tests I've decided to downgrade the apollo-server-express from 2.8.1 to 2.6.2 and everything started working again.

From my understanding the issue could be here. I'm not sure but I don't think that this new version allows to set the schema after the instance has been created (new schema initialization/creation).

Two options would be to:

  1. Create a new server instance on schema changes (which in terms of performance could not be great).
  2. Investigate apollo-gateway (not sure if it makes sense here tbh) because it seems that allows to update the schema.
irisjae commented 4 years ago

+1!

irisjae commented 4 years ago

Super super worried XD!!! The schemas were totally empty. I isolated it to the same issue, and tried modifying prime to use apollo's gateway, when I found your fix, and downgrading did it!

birkir commented 4 years ago

This is the hack I made!

https://github.com/birkir/prime/blob/f28c6a2dc6f2c8692f3b6e2f41d07ab2049787dc/packages/prime-core/src/server.ts#L50-L52

AienTech commented 3 years ago

still facing this issue from time to time, is there a fix for it? or any updates?

AienTech commented 3 years ago

This eventually got fixed (temporarily) by downgrading all apollo-server-core versions to 2.6. For which I used package resolutions.

This change also seems to come from a refactor that is done inside the apollo server itself, thus not being an implementation issue of primecms. The only issue I'd say is here, is that prime packages aren't updated for a long time, which is eventually leading to incompatibility issues for newcomers.