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

Error when reusing Symfony web server SSL certificate #218

Open
WouterCypers opened this issue Jun 5, 2023 · 1 comment
Open

Error when reusing Symfony web server SSL certificate #218

WouterCypers opened this issue Jun 5, 2023 · 1 comment

Comments

@WouterCypers
Copy link

WouterCypers commented Jun 5, 2023

Problem description

I enabled HTTPS by using the Symfony web server SSL certificate as mentioned in the encore docs. However, running yarn dev-server yields the following error:

Running webpack-dev-server ...

<i> [webpack-dev-server] Generating SSL certificate...
<i> [webpack-dev-server] SSL certificate: /Users/woutercypers/Code/test-project/node_modules/.cache/webpack-dev-server/server.pem
[webpack-cli] Error: unsupported
    at configSecureContext (node:internal/tls/secure-context:279:15)
    at Object.createSecureContext (node:_tls_common:117:3)
    at Server.setSecureContext (node:_tls_wrap:1354:27)
    at Server (node:_tls_wrap:1218:8)
    at new Server (node:https:74:3)
    at Object.createServer (node:https:112:10)
    at Server.createServer (/Users/woutercypers/Code/test-project/node_modules/webpack-dev-server/lib/Server.js:2528:57)
    at Server.initialize (/Users/woutercypers/Code/test-project/node_modules/webpack-dev-server/lib/Server.js:1893:10)
    at Server.start (/Users/woutercypers/Code/test-project/node_modules/webpack-dev-server/lib/Server.js:3356:16)
    at async Command.<anonymous> (/Users/woutercypers/Code/test-project/node_modules/@webpack-cli/serve/lib/index.js:257:25)

It appears that this doesn't happen on older versions of Node. I tried Node the following node versions:

  • v14.21.3 - works
  • v16.20.0 - works
  • v18.14.0 - fails
  • v18.16.0 - fails

Used versions

  • PHP: 8.0.28
  • Node: v18.16.0
  • Symfony CLI: 5.5.6
  • symfony/webpack-encore-bundle: v1.17.1
  • webpack-cli: 4.10.0

Steps to reproduce

  1. Make sure to use Node v18
  2. Add the following to your webpack.config.js
const path = require("path");

Encore
    .configureDevServerOptions(options => {
        options.server = {
            type: 'https',
            options: {
                pfx: path.join(process.env.HOME, '.symfony5/certs/default.p12'),
            }
        }
    })
  1. Run yarn dev-server

Any help would be appreciated!

@Kocal
Copy link
Contributor

Kocal commented Jun 5, 2023

See symfony-cli/cert#4

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

2 participants