Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular detected that `HttpClient` is not configured to use `fetch` APIs. (Angular 17 - SSR)

I got this error after updating to angular 17:

NG02801: Angular detected that `HttpClient` is not configured to use `fetch` APIs. It's strongly recommended to enable `fetch` for applications that use Server-Side Rendering for better performance and compatibility. To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` call at the root of the application.

I think after coding my services and importing HttpClient via inject functions it reached to this.

like image 316
Amir Abaris Avatar asked Aug 31 '25 23:08

Amir Abaris


1 Answers

NG02801 is not an error but a warning that encourage the developers to enable the fetch implementation of the HttpClient.

To do this, just call provideHttpClient(withFetch()) in your app.config.ts file.

like image 58
Matthieu Riegler Avatar answered Sep 03 '25 19:09

Matthieu Riegler