Closed KariNarhi28 closed 2 days ago
Create a minimal reproduction case on https://stackblitz.com, and maybe you can get some sort of help. But like you said, it is likely something wrong in your code, not in the libraries.
Tried to create the reproduction but Stackblitz is either really slow or not loading for some reason.
Keeps being stuck on "Building....".
However, if Stackblitz works properly for you others, then this example should be able to reproduce the issue.
Even if this cannot be properly reproduced, I would appreciate if people could point out potential errors in the apollo-client-provider.ts
-configuration.
Honestly, it is not even my own code, it was copied from the Angular-starter made by folks at Vendure.io.
But since this problem seemed to be related to Apollo Angular, I made this issue here instead of Vendure's Angular-starter repo.
EDIT:
I think I might have found the origin, it is related to how the link
-property of the ApolloClientOptions
is configured.
This part here:
link: ApolloLink.from([middleware, afterware, httpLinkHandler]),
When I replaced that with the example in the docs:
link: httpLink.create({ uri, withCredentials: false, })
Then the error disappeared, so the issue must be with the [middleware, afterware, httpLinkHandler] -trio, since link
should accept ApolloLink-type.
EDIT_2:
I guess not, did not help when removed the middleware and afterware.
Now I suspect the request inside the deps:
deps: [HttpLink, PLATFORM_ID, TransferState, [new Optional(), request]],
After commenting out the request
, then the error disappeared again.
I am not an expert of ApolloClientOptions so I don't even know if that [new Optional(), request] -part would do anything in the deps.
This is not a problem with apollo-angular. You are trying to provide request
in a browser environnement where it cannot exist. It can only exist in server environnement.
If the your code comes from Angular-starter, then report an issue over there.
Yeah, my bad. Informed the original source of this issue.
Describe the bug
I have simple Angular starting template with few Angular Material components and Apollo Angular GraphQL-client.
When I add the Apollo-providers to AppConfig-providers, the Material components break.
They do render, but none of the features they have work.
Most likely I might have configured the Apollo-factory -function wrong, but the console errors (see other image below) hint that the issue lies in Apollo-Angular or it's dependencies.
To Reproduce
Steps to reproduce the behavior:
ng new
ng add @angular/material
app.config.ts:
apollo-client-provider.ts:
app.component.html:
app.component.ts:
material.module.ts
Expected behavior
Adding the Apollo-providers should not cause issues for non-related packages, such as Angular Material.
Environment:
Additional context
I am also getting this kind of error to the console. I am not using these Node-modules it refers to.