I have an SSR angular app built with V14.2.1 In my gateway, I have a method that returns a GET request.
const url = environment.apiUrl;
@Injectable()
export class SampleGateway {
constructor(private httpClient: HttpClient){}
getData(id:number): Observable<SomeInterface> {
let params: HttpParams = new HttpParams();
params = params.set('id',id);
return this.httpClient.get<SomeInterface>(`${url}/entity`, {params: params});
}
}
The app builds successfully on the server-side but when this method is called on one of the pages I get this TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined (ANGULAR 14.2.1) error and the page doesn't load.
If I remove options from the request it works correctly.
return this.httpClient.get<SomeInterface>(`${url}/entity`);
What the hell is going on?