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

Upgrade graphql to ^15.1.0 #215

Closed
mishakorablin opened this issue Aug 18, 2020 · 6 comments
Closed

Upgrade graphql to ^15.1.0 #215

mishakorablin opened this issue Aug 18, 2020 · 6 comments

Comments

@mishakorablin
Copy link

Hello,

Would you mind releasing a new version with graphql dependency bump to ^15.1.0? Signature for GraphQLScalarType was changed in 15.1.0 and currently peer dependency declaration results in conflict.

Here are release notes for 15.1.0

Thank you! 🙇

@jaydenseric
Copy link
Owner

I'm a little confused about what you are requesting; our current peer dependency version range for graphql already includes v15.1.0:

"peerDependencies": {
"graphql": "0.13.1 - 15"
},

If you do a fresh install of graphql and graphql-upload in a project (or update your dependencies in an existing project), it should work.

Screen Shot 2020-08-18 at 2 01 54 pm

@Daavidaviid
Copy link

Daavidaviid commented Aug 18, 2020

I encountered the same issue. I can't build and I get this message :

src/schema/resolvers.ts:94:3 - error TS2322: Type 'GraphQLScalarType' is not assignable to type 'GraphQLScalarType | (() => any) | IEnumResolver | IResolverObject<any, any, any> | IResolverOptions<any, any, any>'.
  Type 'GraphQLScalarType' is not assignable to type 'IResolverObject<any, any, any>'.
    Index signature is missing in type 'GraphQLScalarType'.

94   Upload: GraphQLUpload,
     ~~~~~~

  ../node_modules/graphql-tools/dist/Interfaces.d.ts:70:5
    70     [key: string]: (() => any) | IResolverObject<TSource, TContext> | IResolverOptions<TSource, TContext> | GraphQLScalarType | IEnumResolver;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The expected type comes from this index signature.


Found 1 error.

My versions :

{
    "graphql-upload": "^11.0.0",
    "graphql": "^15.3.0",
}

@mishakorablin
Copy link
Author

@jaydenseric peer dependency allows to install @graphql@15.1.0. However your own library depends on graphql@15.0.0 and your definition for GraphQLUpload uses GraphQLScalarType from version 15.0.0 This results in conflict when trying to pass GraphQLUpload to resolvers that expect GraphQLScalarType that matches version 15.1.0.

In short, your peer dependency is only until 15.0.0 and 15.1.0 breaks, the change in 15.1.0 in graphql library wasn't backwards compatible.

@Daavidaviid
Copy link

How would one solve this quickly ? Increasing the peerdependency version number is enough you think ?

@jaydenseric
Copy link
Owner

graphql is unlikely to publish a breaking change in a minor release in violation of semver, but to be sure everything works with the latest version I updated the dev dependencies and ran all the tests successfully.

@mkorablin

However your own library depends on graphql@15.0.0

Perhaps you're confused. My library (I guess you were referring to graphql-upload?) only has a graphql peer dependency, it's not a dependency; see for yourself:

https://unpkg.com/graphql-upload@11.0.0/package.json

@Daavidaviid

How would one solve this quickly

You don't wan't multiple versions of graphql in your node_modules, so best thing to do is to run npm outdated, then update all your dependencies, then delete your package-lock.json, do a fresh npm install to deeply install the most up to date packages as possible, then run npm ls graphql to list all the versions of graphql installed, and what package is installing them.

Probably your project dependencies just need updating, but if a third party package is pulling in an older version of graphql (normally that happens when they "pin" dependencies by not using ^, a big antipattern) you need to figure out if a newer version of that package is available that doesn't have the problem, or else raise an issue/PR to fix it.

Most packages in the graphql ecosystem have graphql as a peer dependency (instead of a regular dependency) specifically to avoid the multiple version headaches you're apparently experiencing; your project's package.json should be the source of truth with a particular graphql version as a dependency.

@Daavidaviid
Copy link

My issue was linked to #214

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

3 participants