You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I can tell, I followed the documentation pretty closely. The project has no errors when I run ng serve, the api calls are working fine locally. Only when I run ng build I see an error. The error I am getting is the following after triggering a build:
Error: src/app/core/graphql/graphql.module.ts:11:33 - error TS2322: Type '{ url: string; }' is not assignable to type 'string | URIFunction'.
Type '{ url: string; }' provides no match for the signature '(operation: Operation): string'.
11 link: httpLink.create({ uri: environment.preloginServiceUrl }),
~~~
node_modules/apollo-angular/http/types.d.ts:12:5
12 uri?: string | URIFunction;
~~~
The expected type comes from property 'uri' which is declared here on type 'Options'
My graphql module:
import { HttpClientModule } from '@angular/common/http';
import { APOLLO_OPTIONS } from 'apollo-angular';
import { HttpLink } from 'apollo-angular/http';
import { InMemoryCache } from '@apollo/client/core';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { environment } from 'src/environments/environment';
export function createApolloFactory(httpLink: HttpLink) {
return {
link: httpLink.create({ uri: environment.preloginServiceUrl }), // HERE WE WILL PUT OUR GRAPHQL URL
cache: new InMemoryCache(),
};
}
@NgModule({
imports: [BrowserModule, HttpClientModule],
providers: [
{
provide: APOLLO_OPTIONS,
useFactory: createApolloFactory,
deps: [HttpLink],
},
],
})
export class GraphQLModule {}
I tried changing around the versions of graphql/apollo packages, but still no luck -- this is the first time I'm encountering this with apollo-angular.. must be something I'm doing wrong?
The text was updated successfully, but these errors were encountered:
From what I can tell, I followed the documentation pretty closely. The project has no errors when I run ng serve, the api calls are working fine locally. Only when I run ng build I see an error. The error I am getting is the following after triggering a build:
My graphql module:
My package.json:
I tried changing around the versions of graphql/apollo packages, but still no luck -- this is the first time I'm encountering this with apollo-angular.. must be something I'm doing wrong?
The text was updated successfully, but these errors were encountered: