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.

SSL errors when using `gatsby develop --https`

See original GitHub issue

Description

When running gatsby develop --https both with without --cert-file/--key-file SSL does not work in Firefox, Chrome or Safari (screenshots below).

Steps to reproduce

  1. I’ve created a minimal reproduction in https://github.com/patrickarlt/gatsby-ssl-issue-reproduction. This is based off the default starter with the latest version of Gatsby.
  2. npm install
  3. npm run start:devcert this starts the local dev server and automatically creates SSL certs.
  4. Observe failures.
  5. Install mkcert, for Mac this means:
    • brew install mkcert
    • brew install nss
    • mkcert install
    • mkcert localhost
  6. npm run start:local-certs this starts the dev server with the local certs from mkcert
  7. Observe failures.

In order to check that the certs are valid you can use http-server:

  • npm i -g http-server
  • http-server . -C localhost.pem -K localhost-key.pem -S -a localhost

This displays the directory structure of our project tin the browser over https://... note the lock icon in Chrome:

2020-05-20_12-26-26 (1)

Expected result

The server should successfully serve pages over https://....

Actual result

Browsers produce SSL errors.

2020-05-20_12-18-35 2020-05-20_12-19-02 2020-05-20_12-19-20

Environment

Gatsby

  System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 14.3.0 - ~/.nvm/versions/node/v14.3.0/bin/node
    npm: 6.14.5 - ~/.nvm/versions/node/v14.3.0/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.138
    Firefox: 77.0
    Safari: 13.1
  npmPackages:
    gatsby: ^2.22.3 => 2.22.3

OpenSSL

$ openssl version
LibreSSL 2.6.5

mkcert

$ brew info mkcert 
mkcert: stable 1.4.1 (bottled)
Simple tool to make locally trusted development certificates
https://github.com/FiloSottile/mkcert
/usr/local/Cellar/mkcert/1.4.1 (6 files, 5.3MB) *
  Poured from bottle on 2020-04-08 at 18:45:14
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mkcert.rb
==> Dependencies
Build: go ✘
==> Analytics
install: 3,827 (30 days), 11,641 (90 days), 47,679 (365 days)
install-on-request: 3,351 (30 days), 10,186 (90 days), 40,390 (365 days)
build-error: 0 (30 days)

nss

$ brew info nss
nss: stable 3.52 (bottled)
Libraries for security-enabled client and server applications
https://developer.mozilla.org/docs/NSS
/usr/local/Cellar/nss/3.52 (225 files, 34.1MB) *
  Poured from bottle on 2020-05-19 at 16:52:58
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/nss.rb
==> Dependencies
Required: nspr ✔
==> Analytics
install: 38,963 (30 days), 105,774 (90 days), 394,028 (365 days)
install-on-request: 8,110 (30 days), 19,022 (90 days), 62,334 (365 days)
build-error: 0 (30 days)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:35 (10 by maintainers)

github_iconTop GitHub Comments

6reactions
mSnuscommented, Jun 6, 2022

Still facing the same problem in 2022 with gatsby 4.13.0

Was trying to access my app in dev mode via HTTPS on my real domain, but receive SSL errors no matter what certs I use.

I need real domain for cookie authorization on back-end (Laravel Sanctum).

2reactions
JustFly1984commented, Jun 3, 2020

@pieh thank you, issue is solved for us, both dev and prod and test working great, although there is one new issue #24758

Read more comments on GitHub >

github_iconTop Results From Across the Web

Local HTTPS
Gatsby provides a way to use a local HTTPS server during development, thanks to devcert. When you enable the https option, a private...
Read more >
How to enable https for GatsbyJS development server
I'll show you how to self-sign a SSL cert, and run gatsby develop in https. ... If embedded on a site running on...
Read more >
How to serve gatsby development build on local network ...
When you are using a custom host, you need to provide the ssl certificate paths. ... gatsby develop --host $(hostname) --https --key-file ....
Read more >
Unable to get local issuer certificate using gatsby
I get an "unable to get local issuer certificate" error when using gatsby develop related to FetchError: request to ...
Read more >
failed, reason: unable to verify the first certificate
The first time I run Gatsby with SSL activated, an error occured. So now the error is fixed, when I run gatsby develop...
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