#Missing "driver" option. Nest thinks I'm using version 10 of @nestjs/graphql but I'm using 9

95 messages Β· Page 1 of 1 (latest)

dense plover
#

I've updated prisma on my app and nothing else, when I run my API I get this error:

ERROR [GraphQLModule] Missing "driver" option. In the latest version of "@nestjs/graphql" package (v10) a new required configuration property called "driver" has been introduced. Check out the official documentation for more details on how to migrate (https://docs.nestjs.com/graphql/migration-guide).

Running yarn why @nestjs/graphql I get the following which clearly states I'm running version 9.

[1/4] Why do we have the module "@nestjs/graphql"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "@nestjs/graphql@9.2.7"
info Reasons this module exists
   - "_project_#common" depends on it
   - Hoisted from "_project_#common#@nestjs#graphql"
   - Hoisted from "_project_#api#@nestjs#graphql"
info Disk size without dependencies: "6.97MB"
info Disk size with unique dependencies: "15.83MB"
info Disk size with transitive dependencies: "17.02MB"
info Number of shared dependencies: 36
Done in 0.95s.

Any ideas what's going on?

sage axle
#

Hey Allan. Long time no see. πŸ™‚

What does your GraphQL module registration look like?

#

Oh wait. You are on version 9? πŸ€”

dense plover
#

Oh hey Scott! πŸ™‚

#

Yes, exactly... V9.

#

Was working before I updated my prisma deps πŸ™„

#

This is my config, it complains about the debug and cors flag too if I have them in place:

#

I did also update typescript from 4.7 to 4.8 and removed the @lament temple/cli package from another API I have in the same workspace.
That's the rundown πŸ˜…

#

(I booted it up after the TS upgrade and it was fine)

sage axle
#

Can you still post your GraphQL module registration (forRoot)?

#

I believe the driver property was in v9 too.

dense plover
#

where export class ConfigService implements GqlOptionsFactory {
And contains the section I pasted above

#
@Injectable()
export class ConfigService implements GqlOptionsFactory {
  public createGqlOptions (): GqlModuleOptions {
    return {
      autoSchemaFile: join(process.cwd(), 'graphql/schema.gql'),
      debug: !this.isLive,
      context: ({ req }) => ({ req }),
      cors: {
        origin: true,
        credentials: true
      }
    }
  }
}
sage axle
#

Are you using Apollo?

dense plover
#

Yes

sage axle
#

Then for SnGs try adding driver: ApolloDriver, to your config. πŸ™‚

dense plover
#

But why am I needing to do this for v9?

sage axle
#

You'll want to get to something like this:

import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';

@Module({
 imports: [
   GraphQLModule.forRoot<ApolloDriverConfig>({
     driver: ApolloDriver,
   }),
 ],
dense plover
#

This is a v10 c hange.

sage axle
dense plover
#

Oh!?

#

Did this come about between v9.1 and 9.2?

sage axle
#

I have no idea tbh.

dense plover
#

My colleague is using 9.1.2 and I'm on 9.2.7. Seems odd for a breaking change

#

Ah ok

sage axle
#

Let me go check. It would interest me just from a knowledge standpoint.

dense plover
#

Going to lock that dep down to 9.1 and see if it works too πŸ™‚

#

Works!

sage axle
#

Interesting. Ok. Then I don't have to go looking. Haha!

dense plover
#

Nope - kinda breaks semantic versioning though TBH.

sage axle
#

I think it's the GraphQL module version possibly. What version are you on?

#

Although, the Nest version should make that a difference. Hmm....

dense plover
#

Even the docs suggest v9 -> v10 is when the driver change was introduced:

sage axle
#

There hasn't been any uproar on this at all. First I'm hearing it.

dense plover
#

How odd πŸ˜„

#

Always me ...

#

Want me to pop a GH issue on for it to be looked at or not bother? I don't mind too much now I know why it's happening but even the error in the console said it was a V10 change so very misleading:

sage axle
#

Yeah, that's version 10 of the Gql module.

#

No need for a GH issue.

dense plover
#

But it's not, its v9.2..

sage axle
#

So, 9.2 of the Gql module or Nest core?

dense plover
#

GQL

sage axle
#

Oh. Oh duh. Ok.

dense plover
#

Having the hat upgrades to 9.2 which then breaks

#

removing the hat to lock at 9.1 is fine.

#

Going to re-test just to make sure it wasn't a one off but even yarn why showed 9.2

sage axle
#

Ok. I'm still going back to look at change logs.

dense plover
#

Ok, back to 9.2 and:

#

And I've had to remove the debug, cors options from my config to get around other compile issues.

#

And to confirm its 9.2:

yarn why v1.22.19
[1/4] Why do we have the module "@nestjs/graphql"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "@nestjs/graphql@9.2.7"
info Reasons this module exists
   - "_project_#common" depends on it
   - Hoisted from "_project_#common#@nestjs#graphql"
   - Hoisted from "_project_#api#@nestjs#graphql"
info Disk size without dependencies: "6.97MB"
info Disk size with unique dependencies: "15.83MB"
info Disk size with transitive dependencies: "17.02MB"
info Number of shared dependencies: 36
Done in 1.01s.

sage axle
#

Interesting, interesting. There is no released version of 9 higher then 9.1.2.

dense plover
#

🀣

#

Tell NPM repo that πŸ˜„

sage axle
#

That is from NPM.

dense plover
#

Eh?!

sage axle
#

Same goes for Github.

dense plover
#

Eh!?! Well it's upgrading me ... How the heck?

sage axle
dense plover
#

Issue with yarn, perhaps?

sage axle
#

Yeah. Very strange.

dense plover
#

Ok, well the fix is simple and given no one else is seeing it, I'll just lock down the version. Worth keeping in mind if others report an issue

sage axle
#

I've dropped yarn many moons ago. Moved to pnpm. πŸ™‚

sage axle
dense plover
#

So odd:

#

Either way, it's sorted with the locked version. Thanks for the brainstorm Scott.

sage axle
#

Huh?

#

Very strange that is. Might want to have Yarn point to npm for packages.

#

I've seen yarn's registry holding crap before.

dense plover
#

Ah, good point. I'll check on that.
Thanks mate.

sage axle
#

Glad I could help a friend. πŸ™‚

#

Doing yarn info <package> versions. I get this:

dense plover
#

Ahhh, wasn't sure how to check the yarn registry.
How comes its soooo wrong?

sage axle
#

Doing npm show <package> versions I get the same.

#

Very strange. πŸ€”

dense plover
#

Haha, this is soo strange

sage axle
#

Maybe @unborn rampart can make rhyme or reason of this.

#

I'd say, let's wait until he comes online.

dense plover
#

I'm wondering if a version was released and then later retracted to make it a new major version change

#

No worries about waiting - I'm up and running with the locked version for now πŸ™‚

sage axle
#

Yeah, that could be. No, I mean me waiting to dig deeper. Haha.

dense plover
#

Yeah, I got it πŸ™‚

sage axle
#

Maybe it was introduced, people got whacked out of shape and then went to major.

dense plover
#

Yep

sage axle
#

I don't recall any ruckus about this though.

#

And I'm a moderator here. So....

dense plover
#

Haha yeah πŸ˜› Always me, as I said ..

sage axle
#

Though, it might have been when I stepped away from my project for a while.

#

It's 2 years old.

dense plover
#

Yeah, I should really upgrade but we're just about to launch into Beta so don't want to rock the boat too much πŸ˜„

sage axle
#

At any rate, hopefully Jay can shed some light on the situation.

unborn rampart
#

9.2.0 was published but has since been deprecated as an "unstable version". Looks like this is when Kamil made the repo into a monorepo and started supporting mercurius. There some logged issues around it, but Kamil said he was publishing under @next which shouldn't usually be installed, but they were being used due to semver compliance.

sage axle
#

Thanks for the clarification Jay.