-
Notifications
You must be signed in to change notification settings - Fork 2k
Upgrade to graphql-upload v8, dropping upload support for Node.js v6. #2054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
abernix
merged 11 commits into
release-vNEXT
from
abernix/throw-when-uploads-on-pre-node-8.5
Dec 4, 2018
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0c2fbc3
feat(uploads): replace apollo-upload-server v5 with graphql-upload v8
lgaticaq 9c563fa
Throw error at startup when file uploads are enabled on Node.js < 8.5.0.
abernix 7e6d6cf
Update to `graphql-upload@8.0.2`.
abernix 2fd56f0
Don't enable uploads when using an unsupported Node.js in tests.
abernix 6dc132e
(tests) Switch to a very explicit Node.js 10 restriction.
abernix cd6e575
(tests) Skip file upload tests for `NODE_MAJOR_VERSION === 6`.
abernix 705256e
(tests): Re-enable file upload tests for Node.js 10. 🎉🎉🎉
abernix 8a58e9f
Update CHANGELOG.md
abernix 363472c
Update migration-file-uploads.md
abernix fe2d597
Update ApolloServer.ts
abernix abb8dc5
Merge branch 'release-vNEXT' into abernix/throw-when-uploads-on-pre-n…
abernix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| title: File uploads in Node.js < v8.5.0 | ||
| --- | ||
|
|
||
| File uploads are supported in Apollo Server 2.x through the third-party [`graphql-upload`](https://npm.im/graphql-upload/) package. While Apollo Server 2.x aims to support Node.js LTS versions prior to v8.5.0, the `graphql-upload` project no longer supports file uploads on versions of Node.js prior to v8.5.0 due to changes in the underlying architecture. | ||
|
|
||
| While Node.js versions prior to v8.5.0 are still under [_Long Term Support_ (LTS) agreements](https://github.com/nodejs/Release#release-schedule) from the Node.js Foundation, **we encourage _all users_ of Apollo Server to update to newer LTS versions of Node.js** prior to the "end-of-life" dates for their current server version. | ||
|
|
||
| For example, while Node.js 6.x is covered by Long Term Support until April 2019, there are substantial performance (e.g. [V8](https://v8.dev/) improvements) and language changes (e.g. "modern" ECMAScript support) offered by newer Node.js engines (e.g. 8.x, 10.x). Switching to newer Long Term Support versions of Node.js comes with long-term benefits; Node.js 10.x LTS releases are covered by the Node.js Foundation through April 2021. | ||
|
|
||
| Since file upload support for Node.js versions prior to v8.5.0 is no longer offered by `graphql-upload`, users of those versions must must disable file uploads to continue using newer Apollo Server 2.x versions. | ||
|
abernix marked this conversation as resolved.
Outdated
|
||
|
|
||
| **To disable file uploads and continue using Apollo Server 2.x on Node.js 6.x**, add the `uploads: false` setting to the options when constructing the server. For example: | ||
|
|
||
| ```js | ||
| const { typeDefs, resolvers } = require('./anOutsideDependency'); | ||
| const server = new ApolloServer({ | ||
| /* Existing Apollo Server settings — e.g. type definitions */ | ||
| typeDefs, | ||
| resolvers, | ||
|
|
||
| /* Add this line to disable upload support! */ | ||
| uploads: false, | ||
|
|
||
| /* ... other Apollo Server settings ... */ | ||
| }) | ||
| ``` | ||
|
|
||
| For additional assistance, please [search for existing issues](https://github.com/apollographql/apollo-server/issues?q=uploads) or file a [new issue](https://github.com/apollographql/apollo-server/issues/new) on the Apollo Server GitHub repository. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import supportsUploadsInNode from './utils/supportsUploadsInNode'; | ||
|
|
||
| // We'll memoize this function once at module load time since it should never | ||
| // change during runtime. In the event that we're using a version of Node.js | ||
| // less than 8.5.0, we'll | ||
| const processFileUploads: | ||
| | typeof import('graphql-upload').processRequest | ||
| | undefined = (() => { | ||
| if (supportsUploadsInNode) { | ||
| return require('graphql-upload') | ||
| .processRequest as typeof import('graphql-upload').processRequest; | ||
| } | ||
| return undefined; | ||
| })(); | ||
|
|
||
| export default processFileUploads; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.