-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Description
Command
serve
Is this a regression?
- Yes, this behavior used to work in the previous version
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
npm install- Run application
npm start- Navigate to
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 serve
- Run application
npm run start:cert- Navigate to
https://localhost:4430and 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.