Graphql-code-generator: typescript-resolvers: maximum call stack size exceeded

Created on 20 Jun 2019  路  7Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug
typescript-resolvers is getting "maximum call stack size exceeded" error when there are 2 types pointing at each other.

Example:

type Account {
    id: ID!
    name: String!
    programs: [Program!]!
}

type Program {
    id: ID!
    name: String!
    account: Account!
}
  1. My codegen.yml config file:
overwrite: true
schema:
  - ./src/graphql/**/*.graphql
generates:
  ./generated/graphqlGeneratedTypes/graphqlServer.ts:
    config:
      typesPrefix: "Gql"
      defaultMapper: Partial<{T}>
      namingConvention:
        typeNames: change-case#pascalCase
        enumValues: change-case#upperCase
    plugins:
      - typescript
      - typescript-resolvers
  • OS: Windwos
  • @graphql-codegen/1.3.0
  • NodeJS: 10.x

Worked with 1.2.1

bug plugins waiting-for-release

All 7 comments

I receive the same error.

@yoavain-sundaysky can you try removing typescript-resolvers? It works fine when I do but of course the output has no resolver types which breaks my code.

the problem seems to be in the typescript-resolvers plugin.
Typescript plugin works fine on my entire project.
I cut my schema to the smallest part that reproduces the problem.
Seems the problem is in the cyclic reference (A -> B, B ->A)

Thanks @yoavain-sundaysky , I'm taking a look now. We did changed some things related to typescript-resolvers.
As a workaround, you can keep using 1.2.1

@yoavain-sundaysky I think I managed to fix that. Can you please try 1.3.1-alpha-671765f6.2 and let me know if it works?

1.3.1-alpha-671765f6.2 works. Thanks!

1.3.1-alpha-671765f6.2 works for me too! Thanks @dotansimha !

Fixed in 1.3.1

Was this page helpful?
0 / 5 - 0 ratings