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

[BUG] snowback build looks for certificate when devOptions.secure = true #3051

Open
4 tasks done
neil-novatech opened this issue Mar 30, 2021 · 2 comments
Open
4 tasks done

Comments

@neil-novatech
Copy link

neil-novatech commented Mar 30, 2021

Bug Report Quick Checklist

  • I am on the latest version of Snowpack & all plugins.
  • I use package manager yarn (Fill in: npm, yarn, pnpm, etc).
  • I run Snowpack on OS Windows (Fill in: Windows, Mac, Linux, etc).
  • I run Snowpack on Node.js v12+

Describe the bug

After upgrading from 3.0.13 to 3.1.0 (and above, through 3.1.2), snowpack build fails when devOptions: { secure: true } is set is snowpack.config.js.

Example error:

yarn run v1.22.0
warning package.json: No license field
$ snowpack build
[11:42:55] [snowpack] ✘ No HTTPS credentials found!
[11:42:55] [snowpack] You can specify HTTPS credentials via either:

  - Including credentials in your project config under devOptions.secure.
  - Including snowpack.crt and snowpack.key files in your project's root directory.

    You can automatically generate credentials for your project via either:

  - devcert: npx devcert-cli generate localhost
    https://github.com/davewasmer/devcert-cli (no install required)

  - mkcert: mkcert -install && mkcert -key-file snowpack.key -cert-file snowpack.crt localhost
    https://github.com/FiloSottile/mkcert (install required)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To Reproduce

We can't fix bugs that we can't see for ourselves. Issues often need to be closed if this section is skipped.

  1. npm init snowpack-app --template @snowpack/app-template-react --target secure
  2. set secure: true in devOptions block in snowpack.config.js
  3. yarn
  4. yarn upgrade snowpack@3.0.13
  5. yarn build
  6. success!
  7. yarn upgrade snowpack@3.1.0
  8. yarn build
  9. See error! [snowpack] ✘ No HTTPS credentials found! ...

Expected behavior

I expect snowpack build to succeed without checking for snowpack.key and snowpack.crt.

Anything else?

It looks like the following PR introduced this behavior while refactoring the build script to reuse the dev server: #2707

@msokk
Copy link
Contributor

msokk commented May 17, 2021

Still an issue in 3.4.0, for a quick workaround, one can use some env variable in config, for example: secure: !process.env.CI

@bdashrad
Copy link

bdashrad commented Apr 8, 2022

Happens on us on 3.8.2 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants