Open ddcollins opened 3 years ago
Describe the bug I've attempted to use the encapsulate and rename transform on my GraphQL source, and each result in an error at query time.
encapsulate
rename
sources: - name: Academy transforms: - filterSchema: - Query.!server - encapsulate: applyTo: query: true mutation: false subscription: false handler: graphql: endpoint: ${DIRECTUS_HOST} schemaHeaders: Authorization: Bearer ${DIRECTUS_API_TOKEN} operationHeaders: Authorization: Bearer ${DIRECTUS_API_TOKEN} batch: false additionalTypeDefs: - ./src/additional-type-definitions.graphql additionalResolvers: - ./src/additional-resolvers.js transforms: # Global - resolversComposition: - resolver: 'Query.*' composer: ./src/middleware/api-token-guard.js - resolver: 'Mutation.*' composer: ./src/middleware/api-token-guard.js - namingConvention: # Causes issue with union types # typeNames: pascalCase enumValues: upperCase fieldNames: camelCase
{ academy { items { course(limit:10) { id title description } } } }
{ "message": "Cannot read property 'columns' of undefined", "name": "GraphQLError", "originalError": {}, "path": [ "academy", "course" ], "source": { "locationOffset": {} }, "stack": [ "GraphQLError: Cannot read property 'columns' of undefined", " at Object.relocatedError (/app/node_modules/@graphql-tools/utils/index.cjs.js:3894:12)", " at mergeDataAndErrors (/app/node_modules/@graphql-tools/delegate/index.cjs.js:1397:34)", " at /app/node_modules/@graphql-tools/delegate/index.cjs.js:1425:66", " at Array.forEach (<anonymous>)", " at mergeDataAndErrors (/app/node_modules/@graphql-tools/delegate/index.cjs.js:1423:27)", " at checkResultAndHandleErrors (/app/node_modules/@graphql-tools/delegate/index.cjs.js:1386:38)", " at CheckResultAndHandleErrors.transformResult (/app/node_modules/@graphql-tools/delegate/index.cjs.js:1382:16)", " at /app/node_modules/@graphql-tools/delegate/index.cjs.js:1569:40", " at Array.reduceRight (<anonymous>)", " at Transformer.transformResult (/app/node_modules/@graphql-tools/delegate/index.cjs.js:1568:37)" ] }
To Reproduce Steps to reproduce the behavior:
- name: Academy transforms: - filterSchema: - Query.!server - encapsulate: name: Academy applyTo: query: true mutation: false subscription: false
- name: Academy transforms: - filterSchema: - Query.!server - rename: - from: type: Query field: items to: type: Query field: academy
Expected behavior Query executes successfully.
Environment:
"@graphql-mesh/cli": "^0.15.*", "@graphql-mesh/graphql": "^0.13.13", "@graphql-mesh/json-schema": "^0.10.2", "@graphql-mesh/transform-encapsulate": "^0.1.23", "@graphql-mesh/transform-filter-schema": "^0.8.27", "@graphql-mesh/transform-naming-convention": "^0.6.26", "@graphql-mesh/transform-rename": "^0.7.21", "@graphql-mesh/transform-resolvers-composition": "^0.7.26"
Additional context
@ardatan Here's a repo I set up with instructions on how to replicate this! https://github.com/ddcollins/mesh-directus-replication.
Describe the bug I've attempted to use the
encapsulate
andrename
transform on my GraphQL source, and each result in an error at query time.To Reproduce Steps to reproduce the behavior:
Expected behavior Query executes successfully.
Environment:
Additional context