dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.84k stars 1.33k forks source link

maximum call stack size exceeded #6167

Open jemink opened 3 years ago

jemink commented 3 years ago

I am getting below error while running graphql-codegen

$ graphql-codegen
  √ Parse configuration
  > Generate outputs
    > Generate hasura/schema.json
      √ Load GraphQL schemas
      √ Load GraphQL documents
      × Generate
        →         at C:/tests/graphql/user.graphql:20:29
    > Generate libs/graphql/generated/graphql.tsx
      √ Load GraphQL schemas
      √ Load GraphQL documents
      × Generate
        →         at C:/tests/graphql/user.graphql:20:29
Maximum call stack size exceeded

My codegen.yml config file:


overwrite: true
schema: hasura/schema.graphql
documents: ['libs/graphql/*.graphql', 'libs/graphql/crm-mutation/*.graphql']
generates:
  hasura/schema.json:
    plugins:
      - introspection
  libs/graphql/generated/graphql.tsx:
    plugins:
      - 'typescript'
      - 'typescript-operations'
      - 'typescript-react-apollo'
    config:
      withHooks: true
      withRefetchFn: false
      withComponent: false
      withMutationOptionsType: true
      withMutationFn: true
      addDocBlocks: true
      addOperationExport: true
      withResultType: true

OS: Windows "@graphql-codegen/add": "2.0.2", "@graphql-codegen/cli": "1.21.2", "@graphql-codegen/fragment-matcher": "2.0.1", "@graphql-codegen/introspection": "1.18.2", "@graphql-codegen/plugin-helpers": "1.18.3", "@graphql-codegen/schema-ast": "1.18.1", "@graphql-codegen/typescript": "1.21.1", "@graphql-codegen/typescript-document-nodes": "1.17.10", "@graphql-codegen/typescript-graphql-files-modules": "1.18.1", "@graphql-codegen/typescript-operations": "1.17.15", "@graphql-codegen/typescript-react-apollo": "2.2.3", "@graphql-codegen/typescript-resolvers": "1.19.0", node:- v14.15.4

dotansimha commented 3 years ago

Hi @jemink and thank you for the report!

Sorry but I'm not adding a lot here but just labeling it according to our new Contribution Guide and issue flow.

It seems like we are on stage 0. Now in order to advance to stage 1 we'll need an easily running reproduction, do you think you can create that on code sandbox?

Thank you and sorry that this comment is not a complete solution (yet).

jemink commented 3 years ago

Hello @dotansimha I added fragment in my **.graphql file and when I run yarn graphql-codegen. I am getting this below error

RangeError: /opt/atlassian/pipelines/agent/build/libs/graphql/generated/graphql.ts: Maximum call stack size exceeded
fragment Test on Test {
  id
  company_id
}
binary64 commented 3 years ago

+1 to add to this issue, I beleive the problem is coming from babel when executed by jest (which I beleive is executed in commonjs mode

trying to create a replica sandbox seems challenging as for me this is a sort of intermittant issue but i will of course post when I have something small that fails with this error.