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

Replace graphql-depth-limit with eg @graphile/depth-limit #22247

Open
jorrit opened this issue Nov 22, 2024 · 1 comment
Open

Replace graphql-depth-limit with eg @graphile/depth-limit #22247

jorrit opened this issue Nov 22, 2024 · 1 comment

Comments

@jorrit
Copy link
Contributor

jorrit commented Nov 22, 2024

I accidently referenced an unexisting Fragment, which caused a hard to debug error in graphql-depth-limit:

TypeError: Cannot read properties of undefined (reading 'kind')
    at determineDepth (....\node_modules\graphql-depth-limit\index.js:63:16)
    at determineDepth (....\node_modules\graphql-depth-limit\index.js:78:14)
    at ....\node_modules\graphql-depth-limit\index.js:72:9
    at Array.map (<anonymous>)
    at determineDepth (....\node_modules\graphql-depth-limit\index.js:71:59)
    at ....\node_modules\graphql-depth-limit\index.js:72:9
    at Array.map (<anonymous>)
    at determineDepth (....\node_modules\graphql-depth-limit\index.js:71:59)
    at ....\node_modules\graphql-depth-limit\index.js:72:9
    at Array.map (<anonymous>)

graphql-depth-limit does not check if a fragment exists when it tries to access it by name. I tried reporting this to graphql-depth-limit, but this project is unmaintained. The GitHub link on NPM refers to an nonexisting repository.
My suggestion is that Strapi moves away from this unmaintained project and implements the depth limit functionality with a package such as @graphile/depth-limit.

@ThiloHettmer
Copy link

Thanks for pointing this out. Couldn't get the fragment to work and it was driving me nuts. I removed the fragment and it worked.

I support this change too

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