Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When using ng serve with SSR and an SSL certificate the HttpClient request fails during SSR
GitHub repo: https://github.com/brandonroberts/angular-ssl-assets
Minimal Reproduction
Setup
- Install dependencies
- Run application
- Navigate to
https://localhost:4430 and notice the error in the command line console, and the flash of data on the page.
Workaround
The workaround is to run NODE_TLS_REJECT_UNAUTHORIZED=0 ng serve
- Run application
- Navigate to
https://localhost:4430 and notice the Node warning in the command line console, but no flash of data on the page.
Exception or Error
ERROR HttpErrorResponse {
headers: _HttpHeaders {
headers: Map(0) {},
normalizedNames: Map(0) {},
lazyInit: undefined,
lazyUpdate: null
},
status: 0,
statusText: 'Unknown Error',
url: 'https://localhost:4430/assets/data.json',
ok: false,
type: undefined,
redirected: undefined,
name: 'HttpErrorResponse',
message: 'Http failure response for https://localhost:4430/assets/data.json: 0 undefined',
error: TypeError: fetch failed
at node:internal/deps/undici/undici:13510:13
at _ZoneDelegate.invoke (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:336:158)
at ZoneImpl.run (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:105:35)
at eval (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:1040:30)
at _ZoneDelegate.invokeTask (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:362:171)
at ZoneImpl.runTask (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:143:37)
at drainMicroTaskQueue (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:522:23)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
[cause]: Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34)
at _ZoneDelegate.invokeTask (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:362:171)
at ZoneImpl.runTask (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:143:37)
at invokeTask (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:439:26)
at TLSSocket.ZoneTask.invoke (/Users/computer/projects/angular-ssl-assets/.angular/cache/20.3.9/angular-ssl-assets/vite/deps_ssr/zone__js_node.js:428:38)
at TLSSocket.emit (node:events:518:28)
at TLSSocket._finishInit (node:_tls_wrap:1078:8)
at ssl.onhandshakedone (node:_tls_wrap:864:12) {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
}
}
Your Environment
Angular: 20.3.9
... build, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router, ssr
Package Version
------------------------------------
@angular-devkit/architect 0.2003.9
@angular-devkit/core 20.3.9
@angular-devkit/schematics 20.3.9
@schematics/angular 20.3.9
rxjs 7.8.2
typescript 5.9.3
zone.js 0.15.1
Anything else relevant?
Its a self-signed certificate for local development using mkcert localhost.
Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When using
ng servewith SSR and an SSL certificate the HttpClient request fails during SSRGitHub repo: https://github.com/brandonroberts/angular-ssl-assets
Minimal Reproduction
Setup
https://localhost:4430and notice the error in the command line console, and the flash of data on the page.Workaround
The workaround is to run
NODE_TLS_REJECT_UNAUTHORIZED=0 ng servehttps://localhost:4430and notice the Node warning in the command line console, but no flash of data on the page.Exception or Error
Your Environment
Anything else relevant?
Its a self-signed certificate for local development using
mkcert localhost.