--https fails if the path of the project contains spaces
See original GitHub issueDescription
command gatsby run develop --https
fails in the generate certificate step if the path of the project contains spaces
Steps to reproduce
I’m on windows, so I don’t know if the same steps will reproduce the issue on other OS’s
- Create a user whose name contains spaces
- Create a project anywhere
- Install openssl and add it to the PATH env variable
- run the command
gatsby develop --https
Expected result
Gatsby generates certificate and starts an https server
Actual result
Error
Error: Command failed: openssl genrsa -out C:\Users\User Name With Spaces\AppData\Local\devcert\config\devcert-ca-root.key 2048
and process exits
Environment
System: OS: Windows 10 CPU: (4) x64 Intel® Core™ i7-6500U CPU @ 2.50GHz Binaries: npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD Languages: Python: 2.7.15 Browsers: Edge: 42.17134.1.0 npmPackages: gatsby: ^2.13.3 => 2.13.3 gatsby-image: ^2.2.4 => 2.2.4 gatsby-plugin-intl: ^0.2.6 => 0.2.6 gatsby-plugin-manifest: ^2.2.1 => 2.2.1 gatsby-plugin-offline: ^2.2.0 => 2.2.0 gatsby-plugin-react-helmet: ^3.1.0 => 3.1.0 gatsby-plugin-sharp: ^2.2.2 => 2.2.2 gatsby-source-filesystem: ^2.1.2 => 2.1.2 gatsby-transformer-sharp: ^2.2.1 => 2.2.1
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
I’m currently tackling this issue! I’m running some tests and should have a PR this weekend.
The issue here is in the npm package
devcerts-san
, called from here:That particular error is generated here:
But this whole function will have trouble:
That utility is calling
openssl
from the shell, and unquoted/unescaped strings are being dropped into the command.There is version 1.0.0, though. It is now called
devcert
(instead ofdevcert-san
), and after a quick look at these few lines, it looks like the bug has been fixed:Upgrading the package should work, but it wouldn’t be just a simple version upgrade, since there were breaking changes. A few things that would effect Gatsby.
keyPath
andcertPath
are no longer returned.(Node’s
https.createServer()
(called here to setup the server) does not require the key/cert paths. Which is probably why they are no longer returned bydevcert
.)