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

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

Closed
uriahcarpenter opened this issue May 18, 2018 · 1 comment

Comments

@uriahcarpenter
Copy link

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.

@hassoncs
Copy link

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

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