Aerolab/rooms

UnhandledPromiseRejectionWarning: Error: Can't set headers after they are sent.

uriahcarpenter opened this issue · 1 comments

After building Docker image...

docker run -p 3000:3000 rooms

> Rooms@0.1.0 start /usr/src/app
> node server.js

Starting Webpack compilation...
API available at port 3000
Compiled successfully in 3409 ms.
(node:17) UnhandledPromiseRejectionWarning: Error: Can't set headers after they are sent.
    at validateHeader (_http_outgoing.js:491:11)
    at ServerResponse.setHeader (_http_outgoing.js:498:3)
    at Object.handleRangeHeaders (/usr/src/app/node_modules/nwb/node_modules/webpack-dev-middleware/lib/Shared.js:71:8)
    at processRequest (/usr/src/app/node_modules/nwb/node_modules/webpack-dev-middleware/middleware.js:63:22)
    at Object.ready (/usr/src/app/node_modules/nwb/node_modules/webpack-dev-middleware/lib/Shared.js:159:29)
    at Object.handleRequest (/usr/src/app/node_modules/nwb/node_modules/webpack-dev-middleware/lib/Shared.js:202:10)
    at /usr/src/app/node_modules/nwb/node_modules/webpack-dev-middleware/middleware.js:44:11
    at new Promise (<anonymous>)
    at webpackDevMiddleware (/usr/src/app/node_modules/nwb/node_modules/webpack-dev-middleware/middleware.js:43:10)
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)
    at /usr/src/app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
    at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/usr/src/app/node_modules/express/lib/router/index.js:174:3)
    at router (/usr/src/app/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:317:13)
    at /usr/src/app/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:335:12)
    at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
    at /usr/src/app/node_modules/connect-history-api-fallback/lib/index.js:73:5
(node:17) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

There were a few dependency warnings:

warning "node-google-calendar > request-promise@4.2.1" has unmet peer dependency "request@^2.34".
warning "request-promise > request-promise-core@1.1.1" has unmet peer dependency "request@^2.34".
warning " > request-promise@4.2.2" has unmet peer dependency "request@^2.34".

I fixed the errors by switching all ^s to ~ in package.json and added

"request-promise": "~4.2.2",
"request":"~2.34.0"

However, these dependency updates didn't make any difference on the UnhandledPromiseRejectionWarning exception.

I had this problem too! I fixed it by using a different node version.
v8.2.1 seems to work!