Skip to content
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

Failed batchDelegateToSchema call doesn't throw/expose errors #6161

Open
4 tasks
theguacamoleking opened this issue May 8, 2024 · 1 comment
Open
4 tasks

Comments

@theguacamoleking
Copy link

theguacamoleking commented May 8, 2024

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

Hello!

I've encountered a number of situations where an error has been encountered while calling batchDelegateToSchema and it's exceptionally hard to find out what went wrong because the function resolves successfully and returns null.

To Reproduce

Steps to reproduce the behavior:

Run batchDelegateToSchema against a schema and specify a fieldName that isn't on the target schema.

// ...
batchDelegateToSchema({
  fieldName: "invalidFieldName",
  key,
  schema,
  validateRequest: true,
  argsFromKeys: (ids) => ({ ids }),
  context,
  info,
});

Expected behavior

  • The promise returned from batchDelegateToSchema throws with an error indicating the outgoing query is invalid

Actual behavior

The promise resolves and returns null. There is seemingly no means for seeing the underlying error thrown lower in the call stack (onLocatedError doesn't throw).

Environment:

  • OS: macOS
  • "@graphql-tools/batch-delegate": "^9.0.2",
  • "@graphql-tools/delegate": "^10.0.10",
  • NodeJS: 20

Additional context

There's another error I'm encountering exclusively in live environments. Again, I don't really see a way to debug it because the function returns and onLocatedError doesn't get called.

Thanks!

@ardatan
Copy link
Owner

ardatan commented May 8, 2024

Could you create a reproduction on CodeSandbox or a failing test in a PR? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants