Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https: mode (devcert) fails with Error: "localhost" is not a valid domain name #35892

Closed
2 tasks done
grgcnnr opened this issue Jun 9, 2022 · 2 comments
Closed
2 tasks done
Labels
type: bug An issue or pull request relating to a bug in Gatsby type: upstream Issues outside of Gatsby's control, caused by dependencies

Comments

@grgcnnr
Copy link
Contributor

grgcnnr commented Jun 9, 2022

Preliminary Checks

Description

On Gatsby 4.15 and 4.16 using a minimal starter with npm init gatsby running gatsby develop -S fails to generate a certificate with devcert

image

This has happened in the past due to a change in the regex devcert uses: #25064

reproduction is literally just the typescript starter with gatsby updated to 4.16.0

Reproduction Link

https://github.com/grgcnnr/gatsby-devcert-minimal

Steps to Reproduce

  1. Checkout + npm i
  2. run npm run develop -- -S
    ...

Expected Result

Gatsby should generate a self-signed certificate and boot the dev server with HTTPS

Actual Result

devcert throws a fatal error "Error: "localhost" is not a valid domain name."

Environment

System:
    OS: macOS 11.6.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Shell: 3.2.57 - /bin/sh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 1.22.18 - ~/.yarn/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 102.0.5005.61
    Safari: 15.5
  npmPackages:
    gatsby: ^4.16.0 => 4.16.0

Config Flags

No response

@grgcnnr grgcnnr added the type: bug An issue or pull request relating to a bug in Gatsby label Jun 9, 2022
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 9, 2022
@grgcnnr grgcnnr changed the title devcert https fails with Error: "localhost" is not a valid domain name https: mode (devcert) fails with Error: "localhost" is not a valid domain name Jun 9, 2022
@grgcnnr
Copy link
Contributor Author

grgcnnr commented Jun 9, 2022

Providing a valid host does fix this issue as long as the hostname points to your loopback IP address in /etc/hosts

ie
$ sudo gatsby develop -S -p 443 --host karbonhq.com

and in /etc/hosts/
127.0.0.1 karbonhq.com

@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 13, 2022
@LekoArts
Copy link
Contributor

As in #25064 - please report this to https://github.com/davewasmer/devcert/issues or pin your version of it. Thanks!

@LekoArts LekoArts closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2022
@LekoArts LekoArts added the type: upstream Issues outside of Gatsby's control, caused by dependencies label Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby type: upstream Issues outside of Gatsby's control, caused by dependencies
Projects
None yet
Development

No branches or pull requests

2 participants