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] CRA5.0.0 [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning on start with .env file configured for HTTPS #11758

Open
jafin opened this issue Dec 15, 2021 · 3 comments

Comments

@jafin
Copy link
Contributor

jafin commented Dec 15, 2021

Describe the bug

Upgrading Project to CRA 5, with a .env.development.local file configured with HTTPS settings, gives warning:

(node:48148) [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning: 'https' option is deprecated. Please use the 'server' option.
(Use `node --trace-deprecation ...` to show where the warning was created)

Did you try recovering your dependencies?

Yes

Environment

current version of create-react-app: 5.0.0

System:
OS: Windows 10 10.0.19044
CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.3.0 - ~\AppData\Roaming\npm\npm.CMD
Browsers:
Chrome: 96.0.4664.93
Edge: Spartan (44.19041.1266.0), Chromium (96.0.1054.53)
Internet Explorer: 11.0.19041.1202
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: ^5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found
(paste the output of the command here.)

Steps to reproduce

  1. Create .env.development.local file with contents similar to :
HTTPS=true 
SSL_CRT_FILE=file.crt
SSL_KEY_FILE=file.key

execute:

npm start run

Verify warning on startup:

(node:48148) [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning: 'https' option is deprecated. Please use the 'server' option.
(Use `node --trace-deprecation ...` to show where the warning was created)

Expected behavior

No warning should occur.

Actual behavior

A warning is issued on startup, app still funcitons.

(node:48148) [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning: 'https' option is deprecated. Please use the 'server' option.
(Use `node --trace-deprecation ...` to show where the warning was created)

Further info

If I execute via CRACO and log the output of the webpack config I see:

https: {
  cert: /* cert */,
  key: /* key */,
},

whereas I believe this is expected:

server: {
  type: 'https',
  options: {
    cert: /* cert */,
    key: /* key */,
  },  
}

As per the webpack 5 docs: https://webpack.js.org/configuration/dev-server/#devserverserver

If I configure craco with a config which maps the properties in the expected shape, the warning disappears (from npm start run):

 devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => {
        devServerConfig.server = {
            type: 'https',
            options: {
                key: devServerConfig.https.key,
                cert: devServerConfig.https.cert
                }
            };
        devServerConfig.https = undefined;
    return devServerConfig;
    },
@jafin jafin changed the title [BUG] CRA5.0.0 [DEP_WEBPACK_DEV_SERVER_HTTPS] warning on start with .env file configured for https [BUG] CRA5.0.0 [DEP_WEBPACK_DEV_SERVER_HTTPS] warning on start with .env file configured for HTTPS Dec 15, 2021
@raix
Copy link
Contributor

raix commented Dec 15, 2021

Confirmed changes in: WDS changelog https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md#440-2021-10-27 - we should move https config into "server" options and align schemas

@raix raix added this to the 5.0.1 milestone Dec 15, 2021
@jafin jafin changed the title [BUG] CRA5.0.0 [DEP_WEBPACK_DEV_SERVER_HTTPS] warning on start with .env file configured for HTTPS [BUG] CRA5.0.0 [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning on start with .env file configured for HTTPS Dec 17, 2021
@luffy84217
Copy link

luffy84217 commented Dec 19, 2021

Hello, is anyone working on it right now? If no, I'll take a look and try to do it

@raix raix modified the milestones: 5.0.1, 5.1 Dec 19, 2021
@luffy84217
Copy link

luffy84217 commented Dec 20, 2021

@iansu @mrmckeb Fixed by #11806 , please review, thanks😊

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

No branches or pull requests

3 participants