graphql-mesh
graphql-mesh copied to clipboard
Cryptic error on build when source handler fails
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 Mesh 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
Our build broke recently and it was throwing a very confusing error. luckily we were able to find the issue and fix it. One of our data sources is Contentful and we were pointing our build to a contentful environment that no longer existed. The error gave no indication that an issue was happening with that particular data source.
It's difficult to know who to contact when we don't know what's failing.
Stack Trace
💥 🕸️ Mesh Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 environmental variable to get more verbose output.
at Object.getMesh (/Users/edwinjackson/path/to/project-root/node_modules/@graphql-mesh/runtime/index.js:69:15)
at async Object.handler (/Users/edwinjackson/path/to/project-root/node_modules/@graphql-mesh/cli/bin.js:1089:53)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
To Reproduce
Steps to reproduce the behavior: To reproduce, configure at least 2 data sources. One that is fine, and another that doesn't exist. There should be in error that doesn't fully describe the situation.
sources:
- name: OkayHandler
handler:
graphql:
endpoint: http://my-serviceA-url:3000/graphql
# This service is down at build time
- name: BrokenHandler
handler:
graphql:
endpoint: https://my-serviceB-url:3000/graphql
then
$ yarn run mesh:build
should produce an output like this:
💥 🕸️ Mesh Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 environmental variable to get more verbose output.
at Object.getMesh (/Users/edwinjackson/path/to/project-root/node_modules/@graphql-mesh/runtime/index.js:69:15)
at async Object.handler (/Users/edwinjackson/path/to/project-root/node_modules/@graphql-mesh/cli/bin.js:1089:53)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
Mesh should indicate which data source handler failed.
Environment:
- OS: macOS
-
"@graphql-mesh/cli": "0.70.3"
: - NodeJS: v16.14.2
So if one of the sources fails, it fails with a long stack trace without giving a clue. Did I understand correctly?
I should have provided a sample stacktrace. I'll update the original comment with some more information.
💥 🕸️ Mesh Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 environmental variable to get more verbose output.
at Object.getMesh (/Users/edwinjackson/path/to/project-root/node_modules/@graphql-mesh/runtime/index.js:69:15)
at async Object.handler (/Users/edwinjackson/path/to/project-root/node_modules/@graphql-mesh/cli/bin.js:1089:53)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.