You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Since the release of v0.78.12 the cli package has an issue that causes a failure on generating the Typescript artifacts.
This happens when working with a single data source and a transform in wrap mode.
This is the output:
💡 🕸️ Mesh Generating the unified schema
💡 🕸️ Mesh - Source1 Dereferencing the bundle
💡 🕸️ Mesh - Source1 Creating the GraphQL Schema from dereferenced schema
💡 🕸️ Mesh Generating artifacts
💡 🕸️ Mesh Generating index file in TypeScript
💥 🕸️ Mesh TypeError: Cannot read properties of undefined (reading 'get')
at generateTsArtifacts (/Users/user/projects/mesh-project/node_modules/@graphql-mesh/cli/bin.js:251:70)
at Object.handler (/Users/user/projects/mesh-project/node_modules/@graphql-mesh/cli/bin.js:1033:19)
To Reproduce
Steps to reproduce the behavior:
Have a Mesh service that works on a single data source (hence no stitching required)
Define a transform at the source level that supports both bare and wrap mode (e.g. naming convention, filterSchema, etc.)
Omit the mode property in the transform config (or set it to wrap)
Run the server
Expected behavior
The artifacts are generated correctly and the server runs as normal.
The text was updated successfully, but these errors were encountered:
Hey @ardatan, I thought I'd summarise my findings on this issue.
This happens because merger-bare is applied by default, at the root level, to the Mesh Config.
Merger-bare does not seem to play nice when used in a single data source (no merging actually required) and at least one wrap mode transform.
In a scenario like this, merger-stitching should be user as a default instead; so this seems to be the first thing to fix.
In fact, if I explicitly apply merger: stitching to the Mesh Config .yaml file, things work again as expected.
Clearly, this is just the initial part of the issue, because developers might still need to user merger: bare and it should just work.
The actual error is generated by generateTsArtifacts which expects a unified schema as first argument.
Then it tries to access the get property out of unifiedSchema.extensions.sourceMap, like this:
The problem, in this case, is that with this configuration (single data-source with merger-bare and wrap-mode transform) the extensions property in the unified schema resolves to [Object: null prototype] {} and so the sourceMap property is undefined.
Instead, in the case of a single source with merger-bare and bare-mode transform, the same extensions property does have sourceMap.get and so generateTsArtifacts can get the transformedSchema.
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
Since the release of v0.78.12 the
cli
package has an issue that causes a failure on generating the Typescript artifacts.This happens when working with a single data source and a transform in
wrap
mode.This is the output:
To Reproduce
Steps to reproduce the behavior:
bare
andwrap
mode (e.g. naming convention, filterSchema, etc.)mode
property in the transform config (or set it towrap
)Expected behavior
The artifacts are generated correctly and the server runs as normal.
The text was updated successfully, but these errors were encountered: