question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

--https fails if the path of the project contains spaces

See original GitHub issue

Description

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

  1. Create a user whose name contains spaces
  2. Create a project anywhere
  3. Install openssl and add it to the PATH env variable
  4. 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rmorabiacommented, Aug 15, 2019

I’m currently tackling this issue! I’m running some tests and should have a PR this weekend.

1reaction
Js-Brechtcommented, Aug 9, 2019

The issue here is in the npm package devcerts-san, called from here:

https://github.com/gatsbyjs/gatsby/blob/c1960a260d3fbd5b6f57fb29317693d45a0686d3/packages/gatsby/src/utils/get-ssl-cert.js

That particular error is generated here:

https://github.com/davewasmer/devcert/blob/v0.3.2/src/utils.ts#L36

But this whole function will have trouble:

https://github.com/davewasmer/devcert/blob/v0.3.2/src/index.ts#L81-L88

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 of devcert-san), and after a quick look at these few lines, it looks like the bug has been fixed:

https://github.com/davewasmer/devcert/blob/master/src/certificates.ts#L28 https://github.com/davewasmer/devcert/blob/master/src/certificates.ts#L36 https://github.com/davewasmer/devcert/blob/master/src/certificates.ts#L44

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.

https://github.com/davewasmer/devcert/blob/v0.3.2/src/index.ts#L71-L76 vs https://github.com/davewasmer/devcert/blob/master/src/index.ts#L71-L74

(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 by devcert.)

Options are listed here: https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build error when path to a project contains spaces · Issue #3183
If I move my project to a directory without spaces in the path, everything builds fine. You can find full build log here:...
Read more >
Pycharm: Run manage task won't work if path contains space
I was trying to create a basic Django new project in folder 'Learing Django api' (my folder name had spaces in it). when...
Read more >
Error when SVN path contains spaces - FinalBuilder
I'm running a FinalBuilder script from ContinuaCI (1.0.0.3010) and I'm getting the following error: Cannot get new changesets for repository ...
Read more >
Visual Studio 2015 gives error when compiling project ...
My C# project includes a reference to a DLL under C:\Program Files (x86)\. Visual Studio 2015 allows me to add this reference but...
Read more >
[issue] spaces in project path cause build errors (was
Deleting spaces in the directory name fixed the problem and now I can do a local compile. I have not been a Linux...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found