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

loader.loaderId is not a function #3246

Closed
dylanwatsonsoftware opened this issue Jul 28, 2021 · 11 comments
Closed

loader.loaderId is not a function #3246

dylanwatsonsoftware opened this issue Jul 28, 2021 · 11 comments

Comments

@dylanwatsonsoftware
Copy link

Describe the bug
The loaderId method was removed from PrismaLoader, however graphql-config uses this method to compare loaders.

I've tracked down the issue to this commit:
9c26b84

To Reproduce
Steps to reproduce the behavior:

Run graphql-codegen (with prisma loader)

Expected behavior
I expect it to generate my code but instead it dies with:
loader.loaderId is not a function

This is thrown by code in graphql-config that expects a loaderId for all loaders. See here: https://github.com/kamilkisiela/graphql-config/blob/89767c8b3dc56a930f42e5e96bcbc43bd5644f41/src/loaders.ts#L33

I can provide a minimal package.json if required but these 2 deps are pulled in by @graphql-codegen/cli@1.21.7 I believe.

@ardatan
Copy link
Owner

ardatan commented Jul 28, 2021

This is an issue on those packages side not GraphQL Tools. We have released a major version with breaking changes including removal of loaderId. So it will be updated on GraphQL Config soon.

@dylanwatsonsoftware
Copy link
Author

Ok cool. I've managed to lock down prisma-loader:
"@graphql-tools/prisma-loader": "6.3.0"
(Was only a transitive dep for me before)
Whilst those other libs update themselves

@zeigernz
Copy link

Ok cool. I've managed to lock down prisma-loader:
"@graphql-tools/prisma-loader": "6.3.0"
(Was only a transitive dep for me before)
Whilst those other libs update themselves

Hey @dylanwatsonsoftware. Have you figured out a workaround for this yet? My build just broke due to the same issue :(

@dylanwatsonsoftware
Copy link
Author

You didn't have any luck just locking down the version of prisma-loader?

@zeigernz
Copy link

Nope. I've added "@graphql-tools/prisma-loader": "6.3.0" to my devDependencies but I still face the same issue. Using "@graphql-codegen/cli": "1.21.7" as well.
I am new to front-end development so please excuse my naivety.

@dylanwatsonsoftware
Copy link
Author

You might also need to delete your package-lock.json and run npm install again.

@zeigernz
Copy link

That didn't help but I will keep digging. Thanks for your help!

@zeigernz
Copy link

Quick update. I managed to sort this out by pinning @graphql-tools/prisma-loader to 6.3.0. I am using yarn so I had to add the following resolution in my package.json:

"resolutions": {
    "@graphql-tools/prisma-loader": "6.3.0"
  }

Then, I deleted node_modules and yarn.lock, ran yarn install and now when I use codegen, I don't get this issue anymore.

@dotansimha
Copy link
Collaborator

More details on this here: dotansimha/graphql-code-generator#6374 (comment)

@n1ru4l
Copy link
Collaborator

n1ru4l commented Jul 29, 2021

@zeigernz I am working on updating graphql-codegen to latest graphql-tools right now 🙂

@vacas
Copy link

vacas commented Nov 24, 2021

I am using yarn so I had to add the following resolution in my package.json

@zeigernz, thanks for this. This was helpful - I ended up making the changes to the package.json located at the global yarn directory (Following their instructions) and resolved my issue.

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

6 participants