graphql-inspector
graphql-inspector copied to clipboard
UnhandledPromiseRejection when running `validate`
Describe the bug
I can't get this project (the validate
command) get to work properly.
Every attempt to (re-)install the needed parts ends up with a correct output, but surrounded by UnhandledPromiseRejection
errors:
$ graphql-inspector validate './src/**/*.graphql.js' http://localhost:3000/graphql
(node:9770) UnhandledPromiseRejectionWarning: Error: Interface field InvoiceActionInterface.previewUrl expects type String! but InvoiceActionLetter.previewUrl is type String.
Interface field AttachmentInterface.documentUrl expects type Download! but TimelineItemAttachment.documentUrl is type Download.
at assertValidSchema (/Users/ivan/path/to/project/node_modules/graphql/type/validate.js:71:11)
at Object.validate (/Users/ivan/path/to/project/node_modules/graphql/validation/validate.js:54:35)
at /Users/ivan/path/to/project/node_modules/@graphql-inspector/core/index.js:1538:32
at Array.forEach (<anonymous>)
at Object.validate (/Users/ivan/path/to/project/node_modules/@graphql-inspector/core/index.js:1514:10)
at handler (/Users/ivan/path/to/project/node_modules/@graphql-inspector/validate-command/index.js:14:33)
at Object.<anonymous> (/Users/ivan/path/to/project/node_modules/@graphql-inspector/validate-command/index.js:182:24)
at Generator.next (<anonymous>)
at fulfilled (/Users/ivan/path/to/project/node_modules/@graphql-inspector/validate-command/node_modules/tslib/tslib.js:114:62)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9770) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:9770) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
To Reproduce Steps to reproduce the behavior:
Followed the Continuous Integration guide (multiple times)
npm i -g @graphql-inspector/ci
# I only need validation command
npm i -g @graphql-inspector/validate-command
# ... comparing the .JS files with a schema from a URL
npm i -g @graphql-inspector/code-loader @graphql-inspector/url-loader
# Also an exact version of yargs is required, according to NPM
npm i -g [email protected] --save-exact
# and graphql packge is required
npm i -g graphql@^15.0.0
# Run the command
graphql-inspector validate './src/**/*.graphql.js' http://localhost:3000/graphql
Expected behavior
I expected this library to not raise any warnings/exceptions along the validation. Also expected the UI look similar to the example.
Environment:
- OS: macOS 12.1 (21C52) (but Ubuntu on Circle CI shows the same behaviour)
-
@graphql-inspector/...
:3.0.2
(also tried all minor versions of above mentioned@graphql-inspector/...
packages down to 2.6.0) -
graphql
:14.7.0
- NodeJS:
14.17.4
Additional context
Installing the CLI version of the package does the same.
These are all globally installed packages:
❯ npm ls -g --depth=0
/Users/ivan/.fnm/node-versions/v14.17.4/installation/lib
├── @graphql-inspector/[email protected]
├── @graphql-inspector/[email protected]
├── @graphql-inspector/[email protected]
├── @graphql-inspector/[email protected]
├── [email protected]
└── [email protected]
Happy to provide any additional information.