-
Notifications
You must be signed in to change notification settings - Fork 2k
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
buildFederatedSchema breaks when minified #3335
buildFederatedSchema breaks when minified #3335
Comments
You may be tempted to ask:
to which I would reply
|
Can you attach a debugger and investigate what is different at runtime between the two scenarios? |
Ah, okay: In case it saves you from the debugger, this is due to the way that we're disabling particular validation rules via leveraging Of course, the |
…ion. The previous technique for deciding which validation rules from `specifiedSDLRules` to by-pass during composition was leveraging a string-comparison against `Function.prototype.name`. As shown in #3335, that technique breaks down under minification, when function names are often munged to shorter alternatives. As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification. While the actual bug in #3335 was _not_ in this code, this code poses the same hazard and would likely be affected as well (eventually, at least).
…ion. The previous technique for deciding which validation rules from `specifiedSDLRules` to by-pass during composition was leveraging a string-comparison against `Function.prototype.name`. As shown in #3335, that technique breaks down under minification, when function names are often munged to shorter alternatives. As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification. While the actual bug in #3335 was _not_ in this code, this code poses the same hazard and would likely be affected as well (eventually, at least).
…ion. The previous technique for deciding which validation rules from `specifiedSDLRules` to by-pass during composition was leveraging a string-comparison against `Function.prototype.name`. As shown in #3335, that technique breaks down under minification, when function names are often munged to shorter alternatives. As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification. While the actual bug in #3335 was _not_ in this code, this code poses the same hazard and would likely be affected as well (eventually, at least).
…ion. (#3338) * Use reference-equality when omitting validation rules during composition. The previous technique for deciding which validation rules from `specifiedSDLRules` to by-pass during composition was leveraging a string-comparison against `Function.prototype.name`. As shown in #3335, that technique breaks down under minification, when function names are often munged to shorter alternatives. As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification. While the actual bug in #3335 was _not_ in this code, this code poses the same hazard and would likely be affected as well (eventually, at least). * Add changelog entry
Similar in spirit to apollographql/apollo-server#3338. The technique previously used for removing rules from the standard `specifiedRules` was leveraging a check on `Function.prototype.name`, rather than doing direct object equality. While that does generally work, thanks to the more recent standardization of `Function.prototype.name`, it still breaks down under some of the more aggressive minification techniques since a function's name is not guaranteed to remain the same. Fixes: apollographql/apollo-server#3335
…1551) Use object equality when filtering rules in `buildSchemaFromSDL` Similar in spirit to apollographql/apollo-server#3338. The technique previously used for removing rules from the standard `specifiedRules` was leveraging a check on `Function.prototype.name`, rather than doing direct object equality. While that does generally work, thanks to the more recent standardization of `Function.prototype.name`, it still breaks down under some of the more aggressive minification techniques since a function's name is not guaranteed to remain the same. Fixes: apollographql/apollo-server#3335
Once we release the (landed/merged outside this repo) fix from apollographql/apollo-tooling#1551 and update |
This commit updates the apollo-graphql package to the latest version. This includes a fix for a bug that currently breaks minification. For reference, see: apollographql/apollo-tooling#1551 Fixes #3335
This commit updates the apollo-graphql package to the latest version. This includes a fix for a bug that currently breaks minification. For reference, see: apollographql/apollo-tooling#1551 Fixes #3335
…ion. (apollographql/apollo-server#3338) * Use reference-equality when omitting validation rules during composition. The previous technique for deciding which validation rules from `specifiedSDLRules` to by-pass during composition was leveraging a string-comparison against `Function.prototype.name`. As shown in apollographql/apollo-server#3335, that technique breaks down under minification, when function names are often munged to shorter alternatives. As an alternative, we can import the rules and check them for reference equality with greater success, since those will not be affected by minification. While the actual bug in apollographql/apollo-server#3335 was _not_ in this code, this code poses the same hazard and would likely be affected as well (eventually, at least). * Add changelog entry Apollo-Orig-Commit-AS: apollographql/apollo-server@0bad61d
…3387) This commit updates the apollo-graphql package to the latest version. This includes a fix for a bug that currently breaks minification. For reference, see: apollographql/apollo-tooling#1551 Fixes apollographql/apollo-server#3335 Apollo-Orig-Commit-AS: apollographql/apollo-server@6a4b681
There seems to be an issue when using buildFederatedSchema while minified.
Per the documentation, when you're using federation, you are expected to use
the
extend
keyword on types that will be merged with other schemas:This syntax breaks when minified, causing the error:
Steps to replicate:
yarn
ornpm install
to install the depedenciesyarn start
ornpm start
to run the non-minified code. You will see the output line "Built"yarn bug
ornpm run bug
to minify and run the minified code. The expected result would be to see "Built" again. The actual result is that it errors out with the aforementioned error.The text was updated successfully, but these errors were encountered: