apollo-server-express version 2.3.0+ contains a breaking change

Created on 14 Dec 2018  Â·  3Comments  Â·  Source: apollographql/apollo-server

The apollo-server-express module has graphql-upload as a sub-dependency:

$ npm ls graphql-upload
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

Unfortunately graphql-upload requires Node.js 8.5.0 or newer, whereas apollo-server-express requires Node.js 6 or newer.

This means that any app using apollo-server-express@^2.3.0 on Node.js versions earlier than 8.5.0 will crash.

Either the new release of apollo-server-express should somehow use an older version of graphql-upload or v2.3.x should be unpublished and re-released as a v3.0.0 instead.

This is the error that is thrown:

*****************************************************************
*                                                               *
* ERROR! Manual intervention is necessary for Node.js < v8.5.0! *
*                                                               *
*****************************************************************
The third-party `graphql-upload` package, which is used to implement
file uploads in Apollo Server 2.x, no longer supports Node.js LTS
versions prior to Node.js v8.5.0.
Deployments which NEED file upload capabilities should update to
Node.js >= v8.5.0 to continue using uploads.
If this server DOES NOT NEED file uploads and wishes to continue
using this version of Node.js, uploads can be disabled by adding:
  uploads: false,
...to the options for Apollo Server and re-deploying the server.
For more information, see https://bit.ly/gql-upload-node-6.
/tmp/node_modules/apollo-server-core/dist/ApolloServer.js:111
                    throw new Error('`graphql-upload` is no longer supported on Node.js < v8.5.0.  ' +
                    ^
Error: `graphql-upload` is no longer supported on Node.js < v8.5.0.  See https://bit.ly/gql-upload-node-6.
    at ApolloServerBase (/tmp/node_modules/apollo-server-core/dist/ApolloServer.js:111:27)
    at ApolloServer (/tmp/node_modules/apollo-server-express/dist/ApolloServer.js:44:1)
    at Test.<anonymous> (/tmp/test/instrumentation/modules/apollo-server-express.js:42:16)
    at Test.bound [as _cb] (/tmp/node_modules/tape/lib/test.js:76:32)
    at Test.run (/tmp/node_modules/tape/lib/test.js:95:10)
    at Test.bound [as run] (/tmp/node_modules/tape/lib/test.js:76:32)
    at Immediate.next (/tmp/node_modules/tape/lib/results.js:71:15)
    at Immediate.elasticAPMCallbackWrapper (/tmp/lib/instrumentation/index.js:201:27)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

Most helpful comment

Removing/deprecating a feature or support for an old platform version should _always_ be a major bump.

All 3 comments

Seems like Node.js 6 was deliberately removed from CI when testing uploads here: https://github.com/apollographql/apollo-server/commit/cd6e575bb788036a9dfbdbc0aae14cc00286afa1

Your assessment is correct, and I hope the error message (which is _intentionally thrown_ by Apollo Server) was enough to save you too much frustration, particularly since it lays out the exact user-invention which is necessary.

We've also documented this known breaking change in the CHANGELOG.md for the 2.3.0 release.

Seems like Node.js 6 was deliberately removed from CI when testing uploads here: cd6e575

This is also correct. And more precisely: this is a deprecation of file-upload support for Node.js 6 LTS on Node.js 6 anymore (since it won't work).

Since you didn't reference it, I'll assume that you didn't catch the more extensive pull-request attached to the commit that you referenced, https://github.com/apollographql/apollo-server/pull/2054, which goes into extensive detail. I encourage you to give it a read, particularly if this affects you beyond the suggestion from the error message to set uploads: false. (From what I can tell from the associated PR from you, that's all you'll need to do.). For better awareness in the future, I've linked this PR directly from the CHANGELOG.md (it should have already been done, sorry!).

Either the new release of apollo-server-express should somehow use an older version of graphql-upload or v2.3.x should be unpublished and re-released as a v3.0.0 instead.

I guess you're mainly taking issue with semver. Even though both of those were considered, since we believe this affects a small number of users (who should take action regardless), and for the reasons in #2054, we don't intend on doing either of those things. If you'd like to open a PR which introduces a shim compat package which conditionally supported both, I'd happily review it, but again, this was a balancing of effort and we anticipate this will fizzle out pretty quickly.

I do apologize for the inconvenience, which I hope is _minor_ in scope (that is, unless you're using Apollo Server 2.x _on_ Node.js 6 _and_ file uploads, in which case, it's a bit more substantial — albeit very important). This isn't something we intend on doing on a regular basis!

Removing/deprecating a feature or support for an old platform version should _always_ be a major bump.

Was this page helpful?
0 / 5 - 0 ratings