-
Notifications
You must be signed in to change notification settings - Fork 240
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
defaultErrorFormatter
throws error for federated errors (when downstream service can't be reached)
#748
Comments
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
* Add constructor argument validation to `FederatedError` to ensure `errors` is an Array * Add input validation tests for FederatedError constructor argument * Fix `request` and `sendRequest` to wrap caught errors in array when creating new `FederatedError` * Add new test file for `request` to ensure array is used * Modify existing `sendRequest` test to verify array is used * Add support for passing in undici agent as part of the federated service configuration. Required for injection during tests. See nodejs/undici#996
I created the above PR to address the issue and help ensure it doesn't accidentally happen elsewhere by validating the input for One thing that is up for discussion is the extension of the options for services that allows passing in a Note and likely unrelated: One of the existing tests ( |
Great!
I think the PR is ok as it is, thanks!
Tests seems passing on CI (but they are flaky from time to time). Would you like to send a different PR to address this? |
* Add constructor argument validation to `FederatedError` to ensure `errors` is an Array * Add input validation tests for FederatedError constructor argument * Fix `request` and `sendRequest` to wrap caught errors in array when creating new `FederatedError` * Add new test file for `request` to ensure array is used * Modify existing `sendRequest` test to verify array is used * Add support for passing in undici agent as part of the federated service configuration. Required for injection during tests. See nodejs/undici#996
re: The failing test. I wasn't able to get that test to pass and I don't have the time to troubleshoot it at the moment. Since it's passing on CI, we can probably ignore for the time being. |
Ran into the following issue (locally/in development) using Mercurius in gateway mode to a downstream Mercurius API that isn't running. The error I'm seeing is
error.extensions.errors.map is not a function
.The relevant code https://github.com/mercurius-js/mercurius/blob/master/lib/errors.js#L57 expects
error.extensions.errors
to be an array:However, in reality is just an object with
{"errno":-61,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":1234}
or toStringed:Or looking at the top level error:
Sample snippet to reproduce with alternate simple custom formatter commented out to log the object that can be used as a simplified workaround:
The text was updated successfully, but these errors were encountered: