-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby): Switching from devcert-san to devcert to fix HTTPS issues #16726
Conversation
Did you have a moment to investigate the key/cert paths shown here? Since they're not returned by I guess if they're needed, somebody could issue a PR over @ |
AFAICT, this fixes the issue (with paths) on Windows. 👍 However, it causes other issues. It installs the certificate in the Certificate Authority store, but when it tries to open Firefox to run the wizard for trusting the cert, the page it opens results in an endless refresh loop. And that CA cert is basically useless. No trust... "SEC_ERROR_BAD_SIGNATURE". Site still shows security errors. I've opened issue davewasmer/devcert#35 This is definitely a regression from the previous version. On a path with no spaces, the previous version works correctly. |
Yep, had the same issues with the cert stuff. I had assumed that it was the key cert path issues that was causing this so I didn't change this. However, I had the same issue even without my changes, so I just decided to submit the PR anyway. Right now, the rest of this is above my level of understanding, so I guess let me know if there's anything I can do. |
i'll see what I can do :) |
Is it just me, or is there something weird going on with Really, it could just be me. I didn't try wiping it all out and starting over. Could be the yarn cache, too... |
Nope, had the same issue! I thought that was a general I have no clue how my 5 lines of code change could mess up that much, lol. EDIT: Perhaps it's an issue with the |
@rmorabia have you tried updating your repo? It looks like you're on |
Let me try messing around with that and see if that fixes the issue there. Not a huge deal either way I think, the certs issue is still way above my head, but i can try and get the |
@wardpeet I'm pretty sure this can be merged, yeah? I could run another test, just to make sure it doesn't cause any issues... the other problems that were noticed before are kind of a separate issue. Merging this would at least close #16212. The other issues with certificates should be fixed by davewasmer/devcert#41 if/when it gets merged (and #18703, by extension). One caveat: |
Sorry I ghosted on this -- I couldn't find the issue, I assume it's the package.json/yarn.lock stuff. Up to y'all what you want to do on this. |
@rmorabia This should fix the issue with the tests 👇 Diff output... see attached if you want to do a patchdiff --git a/packages/gatsby/src/utils/__tests__/get-ssl-cert.js b/packages/gatsby/src/utils/__tests__/get-ssl-cert.js
index 7191c7496..8ef7651b6 100644
--- a/packages/gatsby/src/utils/__tests__/get-ssl-cert.js
+++ b/packages/gatsby/src/utils/__tests__/get-ssl-cert.js
@@ -11,13 +11,13 @@ jest.mock(`gatsby-cli/lib/reporter`, () => {
info: jest.fn(),
}
})
-jest.mock(`devcert-san`, () => {
+jest.mock(`devcert`, () => {
return {
- default: jest.fn(),
+ certificateFor: jest.fn(),
}
})
-const devcertSan = require(`devcert-san`).default
+const { certificateFor } = require(`devcert`)
const reporter = require(`gatsby-cli/lib/reporter`)
const getSslCert = require(`../get-ssl-cert`)
@@ -25,7 +25,7 @@ describe(`gets ssl certs`, () => {
beforeEach(() => {
reporter.panic.mockClear()
reporter.info.mockClear()
- devcertSan.mockClear()
+ certificateFor.mockClear()
})
describe(`Custom SSL certificate`, () => {
it.each([[{ certFile: `foo` }], [{ keyFile: `bar` }]])(
@@ -60,11 +60,11 @@ describe(`gets ssl certs`, () => {
describe(`automatic SSL certificate`, () => {
it(`sets up dev cert`, () => {
getSslCert({ name: `mock-cert` })
- expect(devcertSan).toBeCalledWith(`mock-cert`, { installCertutil: true })
+ expect(certificateFor).toBeCalledWith(`mock-cert`, { installCertutil: true })
expect(reporter.info.mock.calls).toMatchSnapshot()
})
it(`panics if certificate can't be created`, () => {
- devcertSan.mockImplementation(() => {
+ certificateFor.mockImplementation(() => {
throw new Error(`mock error message`)
})
getSslCert({ name: `mock-cert` }) |
I'll fix the tests tonight/tomorrow night. |
Ahh, still getting failing tests because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple notes to try to get the build on track
There's other things that might need to happen for this update to go smoothly. For one, the common name of the certificate generated will match the project name; meanwhile, @rmorabia This is something that I address in PR #18703, but if you wanted to fix it here, I will make sure mine aligns with yours. Another problem: the password prompt that's generated for Windows users doesn't work very well. Not a very big deal, and a fix for it is already part of #18703. It will probably hold until then. Progress is being made on |
Hi @rmorabia 👋 Do you have time to rebase your PR onto master and fix the merge conflict? |
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I did a few modifications to bring back old support so it gets issued to the host we're running develop on.
Holy buckets, @rmorabia — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Fixed in |
devcert-san
todevcert
Description
I changed
devcert-san
todevcert
as described by @Js-Brecht in this comment: #16212 (comment)This should work, however, I'm running on Linux (unix line endings?) and can't confirm it. Can someone on Windows run the repo before the PR is merged and confirm it's fixed?
Related Issues
Fixes #16212