Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected error "You must pass a scope and parentPath unless traversing a Program/File" #6252

Closed
4 tasks
ignazio-bovo opened this issue Jun 10, 2024 · 3 comments

Comments

@ignazio-bovo
Copy link

ignazio-bovo commented Jun 10, 2024

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools 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
Running graphql-codegen gives:

@graphql-tools/graphql-tag-pluck/node_modules/@babel/template/lib/index.js:53
      throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.");

To Reproduce Steps to reproduce the behavior:

I am using the following dependencies in my package json

    "@graphql-codegen/cli": "^1.21.4",
    "@graphql-codegen/import-types-preset": "^1.18.1",
    "@graphql-codegen/typescript": "^1.22.0",
    "@graphql-codegen/typescript-document-nodes": "^1.17.11",
    "@graphql-codegen/typescript-operations": "^1.17.16",

Whenever I am using the graphql-codegen, it started to output the above error. It was not happening before

Expected behavior

I am not familiar with the inner working, but I believe the step is needed to generate the typescript definitions starting from the graphql schema

Environment:

  • OS: mac os Sonoma 14.1
  • @graphql-tools/...: see above
  • NodeJS: 18.x (tried also with 20 and 22)
@ardatan
Copy link
Owner

ardatan commented Jun 10, 2024

Thanks for creating the issue but in order to help you better we need a clear, isolated and minimal reproduction.

@ignazio-bovo
Copy link
Author

Thank you for following up. The resolution for this issue involved deleting a few node_modules directories within various workspaces inside the project. After that, re-running the command resolved the problem.

Minimal reproduction is a bit involved in my case and the issue has been resolved.
Let me know if you would like me to post it any case, feel free to close the issue otherwise

@ardatan ardatan closed this as completed Jun 11, 2024
@ardatan
Copy link
Owner

ardatan commented Jun 11, 2024

Thank you for the feedback! I'm closing the issue then. If anyone else has the same issue, we can re-open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants