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
Allow landing page to be configured with a precomputed nonce (fix for CF workers) #7601
Merged
Conversation
This file contains 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
✅ Deploy Preview for apollo-server-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
❌ Deploy Preview for apollo-server-docs failed.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 52bee17:
|
Cloudflare workers don't allow calls to crypto fns among other things during startup (only during requests). This allows users to provide that beforehand and bypass the need to call crypto functions.
trevor-scheer
force-pushed
the
trevor/use-web-crypto-if-available
branch
from
June 7, 2023 19:14
a508f32
to
7605df5
Compare
trevor-scheer
changed the title
Use Web Crypto API when available to support web workers
Allow landing page to be configured with a precomputed nonce (fix for CF workers)
Jun 7, 2023
mayakoneval
approved these changes
Jun 7, 2023
trevor-scheer
force-pushed
the
trevor/use-web-crypto-if-available
branch
from
June 7, 2023 19:29
ee0bfb8
to
3ffa445
Compare
Merged
trevor-scheer
pushed a commit
that referenced
this pull request
Jun 7, 2023
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @apollo/server-integration-testsuite@4.7.3 ### Patch Changes - Updated dependencies \[[`75b668d9e`](75b668d)]: - @apollo/server@4.7.3 ## @apollo/server@4.7.3 ### Patch Changes - [#7601](#7601) [`75b668d9e`](75b668d) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Provide a new configuration option for landing page plugins `precomputedNonce` which allows users to provide a nonce and avoid calling into `uuid` functions on startup. This is useful for Cloudflare Workers where random number generation is not available on startup (only during requests). Unless you are using Cloudflare Workers, you can ignore this change. The example below assumes you've provided a `PRECOMPUTED_NONCE` variable in your `wrangler.toml` file. Example usage: ```ts const server = new ApolloServer({ // ... plugins: [ ApolloServerPluginLandingPageLocalDefault({ precomputedNonce: PRECOMPUTED_NONCE, }), ], }); ``` Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
#7539 introduced a
v4()
call from theuuid
package which broke CF workers (apollo-server-integrations/apollo-server-integration-cloudflare-workers#37). This change allows users to configure / precompute thenonce
in advance to avoid making crypto-y calls on startup (which CF workers throws errors about).