Skip to content

Error: Cannot return null for non-nullable field when using multiple source handlers #4862

Open
@uknowpro

Description

@uknowpro

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • 1. The issue provides a reproduction available on Stackblitz

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
[CASE 1] Use merger: bare And multiple source handler(graphql, openapi) in mesh config

  1. Use graphql from graphql handler
  2. Then "Error: Cannot return null for non-nullable field" occurred.
  • Using graphql from openapi handler is normal

[CASE 2] Un-use merger: bare And multiple source handler(graphql, openapi) in mesh config

  1. Use graphql from graphql handler or openapi handler
  2. Then "TypeError: Cannot read properties of undefined (reading 'Query')" occurred.
  • The above two erros are occurred. (if namingConvention.mode is set to bare or wrap.)

To Reproduce
Steps to reproduce the behavior:

  1. Go to: https://stackblitz.com/edit/node-hvpuk3
  2. yarn
  3. yarn start
  4. In the GraphiQL Ui try the following query
query getUserInfo {
  getUserInfo(id: "1") {
    id
  }
}

image

Expected behavior
When using graphql and openapi handlers, I want the query to work by applying transforming normally without errors.

  • (actual use) transforms
    • namingConvention
    • rename
    • filterSchema
    • resolversComposition

Environment:

  • OS: MacOS
  • @graphql-mesh/...:
    "@graphql-mesh/cli": "^0.80.1",
    "@graphql-mesh/config": "^8.0.34",
    "@graphql-mesh/graphql": "^0.32.2",
    "@graphql-mesh/merger-bare": "^0.15.49",
    "@graphql-mesh/openapi": "^0.33.38",
    "@graphql-mesh/runtime": "^0.44.35",
    "@graphql-mesh/transform-filter-schema": "^0.14.112",
    "@graphql-mesh/transform-naming-convention": "^0.12.2",
    "@graphql-mesh/transform-rename": "^0.13.1",
    "@graphql-mesh/transform-resolvers-composition": "^0.12.110"
  • NodeJS: 16.13.0

Additional context
If downgrade only the @graphql-mesh/runtime to version 0.43.4 in the above package, all of the mentioned errors will not occur. All other conditions are the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions