question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apollo has a constructor which is not compatible with Dependency Injection. It should probably not be @Injectable().

See original GitHub issue

I was following documentation from the https://www.apollographql.com/docs/angular/basics/setup/ trying to install Apollo Angular.

After running ng add apollo-angular and updating API endpoint in the graphql.module.ts, I’m getting Apollo has a constructor which is not compatible with Dependency Injection. It should probably not be @Injectable(). when trying to inject Apollo from apollo-angular in any component or service.

Angular version: 8.2.11 Angular Apollo version: 1.8.0

How this could be resolved?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:19 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
kamilkisielacommented, Nov 21, 2019

There’s no stable Angular 9 yet so you guys please give me time to solve it. I started creating apollo-angular when Angular was in alpha, then in beta and then they changed bunch of stuff in one of RCs.

As @Vilsol pointed out. It’s no longer an issue in 9.0.0-rc.2.

It’s an open-source project and I’m the only one developing it (Apollo Team haven’t pushed a single line of code). If you want to help, please provide reproductions or even pull requests, this speeds up things a lot.

7reactions
wSedlacekcommented, Dec 8, 2019

@kamilkisiela I want to personally thank you for all your work. This project is awesome. I really do appreciate you taking the time to look into this. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

This constructor is not compatible with Angular Dependency ...
Error: This constructor is not compatible with Angular Dependency Injection because its dependency at index 0 of the parameter list is invalid.
Read more >
Error :This constructor is not compatible with Angular ...
This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an...
Read more >
Dependency Injection - Hot Chocolate
Of course this does not apply within your own dependencies. Your ServiceA class can still inject ServiceB through the constructor.
Read more >
Dependency injection in React - LogRocket Blog
Dependency injection (DI) is a pattern where components necessary for your code to run are hot-swappable. This means that your dependencies ...
Read more >
Dependency injection - TypeGraphQL
TypeGraphQL supports this technique by allowing users to provide their IoC container that will be used by the framework. Basic usage. The usage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found