简体   繁体   中英

Type-graphql with lerna --- Error: Cannot determine GraphQL output type for id

I have recently moved from yarn/workspaces to lerna/npm, and in that move I have unearthed an unexpected problem. I know get:

Error: Cannot determine GraphQL output type for id when generating my schema

I am using type-graphql along with typeorm (a wonderful combo)

My package structure looks like the following

/app
   /packages
       /utils (common functions)
       /data (my TypeORM entities, repos, factories, decorated with type-graphql)
       /server (my type-graphql server) deps on @app/data
       /server-test (tests my server) also deps on @app/data

after I do a: lerna clean cd app/packages/server npm run start

I now get Error: Cannot determine GraphQL output type for id

both data and server's package.json refer to "type-graphql": "^0.17.4"

====== Note in: https://github.com/19majkel94/type-graphql/issues/69

@19majkel94 states the following:

The last error Cannot determine GraphQL output type for id basically comes from getGraphQLOutputType and convertTypeIfScalar which performs if type instanceof GraphQLScalarType. The problem is that separate project has separate node_modules so GraphQLScalarType !== GraphQLScalarType.

From my experience there's always too much problems from separating things to projects/modules than the benefits of this. I would recommend restructuring your app to don't need this.

So that seems a bit nuclear for me to forgo lerna, and modularization. I would love to see if there is a way to make this work.

只需使用依赖项提升,因此您的所有包都将使用根节点node_modulesgraphql模块。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM