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

Passing an SSL key or certificate as a raw string results in an exception #1674

Closed
1 of 2 tasks
MLoughry opened this issue Feb 20, 2019 · 2 comments · Fixed by #1676
Closed
1 of 2 tasks

Passing an SSL key or certificate as a raw string results in an exception #1674

MLoughry opened this issue Feb 20, 2019 · 2 comments · Fixed by #1676

Comments

@MLoughry
Copy link

  • Operating System: Windows 10
  • Node Version: 11.1.0
  • NPM Version: 6.4.1
  • webpack Version: 4.27.1
  • webpack-dev-server Version: 3.2.0
  • This is a bug
  • This is a modification request

Code

// startWebpackDevServer.ts
/** `ssl` contains the `key` and `cert` properties as raw strings, rather than filenames */
const { ssl } = getUserConfig();
httpsConfig = {
    https: {
        ...ssl,
    },
};

const server = new WebpackDevServer(
        compiler,
        Object.assign(
            httpsConfig,
            {
                port: 3000,
                inline: true,
                quiet: false,
                noInfo: false,
                headers: {
                    'Access-Control-Allow-Origin': '*',
                    'Access-Control-Allow-Credentials': 'true',
                },
                stats: 'errors-only',
                reporter: reporter,
            },
            config.devServer
        )
    );

Expected Behavior

webpack-dev-server operates as it did prior to 3.2.0, without throwing an exception

Actual Behavior

(node:15556) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, lstat '-----BEGIN RSA PRIVATE KEY-----
<<REDACTED>>
-----END RSA PRIVATE KEY-----
'
    at Object.lstatSync (fs.js:861:3)
    at new Server (D:\vso\client-web\node_modules\owa-build\node_modules\webpack-dev-server\lib\Server.js:573:38)

For Bugs; How can we reproduce the behavior?

Pass the raw SSL key and/or cert, rather than a Buffer or filepath, to the https config

For Features; What is the motivation and/or use-case for the feature?

@alexander-akait
Copy link
Member

alexander-akait commented Feb 21, 2019

hm, it is interesting how it works before because we use code 0b89fd9

@alexander-akait
Copy link
Member

@MLoughry PR #1676, anyway, better to use files for this, because pfx can't be string due it is binary format

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

Successfully merging a pull request may close this issue.

2 participants