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

GraphQL Mesh SDK Failed (1 errors): Unknown type \"ID\". #895

Closed
META-DREAMER opened this issue Sep 2, 2020 · 3 comments
Closed

GraphQL Mesh SDK Failed (1 errors): Unknown type \"ID\". #895

META-DREAMER opened this issue Sep 2, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@META-DREAMER
Copy link

Trying to use the generated SDK, but in my custom resolver when I call the SDK it gives the following error before even making the request to the remote API.

GraphQLError [Object]: Unknown type "ID".
  at Object.NamedType (<REDACTED>/node_modules/graphql/validation/rules/KnownTypeNamesRule.js:55:29)
at Object.enter (<REDACTED>/node_modules/graphql/language/visitor.js:323:29)
at Object.enter (<REDACTED>/node_modules/graphql/utilities/TypeInfo.js:370:25)
at visit (<REDACTED>/node_modules/graphql/language/visitor.js:243:26)
at Object.validate (<REDACTED>/node_modules/graphql/validation/validate.js:69:24)
at validateRequest (<REDACTED>/dist/delegate/src/delegateToSchema.js:129:20)
at delegateRequest (<REDACTED>/dist/delegate/src/delegateToSchema.js:96:9)
at Object.delegateToSchema (<REDACTED>/dist/delegate/src/delegateToSchema.js:22:12)
at <REDACTED>/dist/wrap/src/generateProxyingResolvers.js:80:47
at <REDACTED>/dist/wrap/src/generateProxyingResolvers.js:76:16 {
  message: 'Unknown type "ID".',
    locations: [],
    path: [ 'suggestProperties' ]
}

This is happening with the OpenAPI handler. My .meshrc.yml:

sources:
  - name: PriceFinder
    handler:
      openapi:
        source: ./priceFinder.json
        operationHeaders:
          Authorization: Bearer {args.priceFinderToken}
        baseUrl: https://api.pricefinder.com.au/v1/

require:
  - ts-node/register/transpile-only

If I remove the args.priceFinderToken and hardcode the token instead, it works fine. However, that is not feasible for me since I need to get a new token in runtime since they expire after 1 hour. I tried using {context.priceFinderToken} instead as well. but that didn't work with fastify-gql which is the GraphQL server I am using.

@ardatan
Copy link
Owner

ardatan commented Sep 2, 2020

Could you share a reproduction CodeSandbox by any chance?
Thanks!

@ardatan ardatan added the bug Something isn't working label Sep 2, 2020
@META-DREAMER
Copy link
Author

@ardatan Here's the codesandbox: https://codesandbox.io/s/fragrant-currying-i6kyy?file=/app.ts.

You can make the query at the /playground path like this:

image

@ardatan
Copy link
Owner

ardatan commented Mar 31, 2023

Seems to be working in the latest release. Let us know if the issue persists.

@ardatan ardatan closed this as completed Mar 31, 2023
This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants