ng serve not working when setting up local SSL
π Bug report
Command (mark with an x)
- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] extract-i18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description
I am trying to configure my local SSL for my Angular app inside the WSL2 Ubuntu 20.04 environment and what I end up doing is to create a key and cert file using openssl. Everything works fine when I use ng serve --ssl true --ssl-cert CA.crt --ssl-key CA.key but when I configure the angular.json file of my project using the config below:
...
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"ssl": true,
"sslKey": "CA.key",
"sslCert": "CA.crt"
}
...
and run it using ng serve I am getting an error of An unhandled exception occurred: error:0909006C:PEM routines:get_name:no start line
See "/tmp/ng-tlxl9X/angular-errors.log" for further details.
π¬ Minimal Reproduction
- Generate your own crt and key file using openssl
- Register the crt file to the host
- Create simple hello world Angular App
- Run the app using this command
ng serve --ssl true --ssl-cert <path-to-crt-file> --ssl-key <path-to-key-file>the app should work just fine and run in https without any issues. - Configure the app
angular.jsonto use ssl, sslKey, sslCert and run the app again using the commandng servethe app should not run and will throw the error of something similar to thisAn unhandled exception occurred: error:0909006C:PEM routines:get_name:no start line See "/tmp/ng-tlxl9X/angular-errors.log" for further details.
π₯ Exception or Error
An unhandled exception occurred: error:0909006C:PEM routines:get_name:no start line
See "/tmp/ng-tlxl9X/angular-errors.log" for further details.
π Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 13.3.9
Node: 16.16.0
Package Manager: npm 8.15.1
OS: linux x64
Angular: 13.3.11
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1303.9
@angular-devkit/build-angular 13.3.9
@angular-devkit/core 13.3.9
@angular-devkit/schematics 13.3.9
@angular/cli 13.3.9
@schematics/angular 13.3.9
rxjs 7.5.6
typescript 4.6.4
Hello, we reviewed this issue and determined that it doesn't fall into the bug report or feature request category.
Please see: https://stackoverflow.com/questions/63030755/error-error0909006cpem-routinesget-nameno-start-line-node
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.