xiaoyunyang / looseleaf-node

Website built on the MERN stack (with react-router v4).
https://looseleafapp.com
12 stars 7 forks source link

Unhandled Promise Rejection #9

Open xiaoyunyang opened 6 years ago

xiaoyunyang commented 6 years ago

Error occurs every time passport is used to log in user. The error dump are below:

Facebook

Logging in from CommunityGuest page through facebook and getting redirected back to CommunityUser page.

::1 - GET /auth/facebook?redirPath=/community/designers/projects HTTP/1.1 302 0 - 0.918 ms
::1 - GET /auth/facebook/callback?code={some code}
::1 - GET /community/designers/projects HTTP/1.1 200 3719 - 5.345 ms
::1 - GET /index.css HTTP/1.1 304 - - 0.306 ms
::1 - GET /communityuser.bundle.js HTTP/1.1 304 - - 0.381 ms
::1 - GET /api/project HTTP/1.1 304 - - 2.272 ms
(node:26522) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot 
set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:469:11)
    at ServerResponse.header (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:767:10)
    at ServerResponse.send (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:170:12)
    at /Users/xiaoyun/LooseLeaf/Website/looseleaf-node/client/iso-middleware/renderLandingApp.jsx:34:16
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26522) 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: 9)

Github

Logging in from Landing home page through github and getting redirected back to User home page.

::1 - GET /auth/github?redirPath=/ HTTP/1.1 302 0 - 0.805 ms
::1 - GET /auth/github/callback?code={some code} HTTP/1.1 302 46 - 1002.604 ms
(node:26522) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot 
set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:469:11)
    at ServerResponse.header (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:767:10)
    at ServerResponse.send (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:170:12)
    at /Users/xiaoyun/LooseLeaf/Website/looseleaf-node/client/iso-middleware/renderLandingApp.jsx:34:16
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26522) 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: 10)
::1 - GET / HTTP/1.1 200 8183 - 12.327 ms
::1 - GET /index.css HTTP/1.1 304 - - 0.943 ms
::1 - GET /logo.png HTTP/1.1 304 - - 0.571 ms
::1 - GET /user.bundle.js HTTP/1.1 304 - - 0.435 ms
::1 - GET /api/hello HTTP/1.1 304 - - 0.780 ms
(node:26522) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot 
set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:469:11)
    at ServerResponse.header (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:767:10)
    at ServerResponse.send (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:170:12)
    at /Users/xiaoyun/LooseLeaf/Website/looseleaf-node/client/iso-middleware/renderLandingApp.jsx:34:16
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26522) 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: 11)

Local

Logging in from Project page to through email+password getting redirected back to the same Project page.

::1 - POST /auth/login HTTP/1.1 200 2 - 227.223 ms
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:469:11)
    at ServerResponse.header (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:767:10)
    at ServerResponse.send (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:170:12)
    at done (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:1004:10)
    at tryHandleCache (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/ejs/lib/ejs.js:228:10)
    at View.exports.renderFile [as engine] (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/ejs/lib/ejs.js:437:10)
    at View.render (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/view.js:135:8)
    at tryRender (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/application.js:640:10)
    at Function.render (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/application.js:592:3)
    at ServerResponse.render (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:1008:7)
    at /Users/xiaoyun/LooseLeaf/Website/looseleaf-node/server/server.js:220:19
    at Layer.handle [as handle_request] (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/router/index.js:317:13)
    at /Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/router/index.js:275:10)
location undefined
::1 - GET /project/this-is-a-test-jb2t2cr HTTP/1.1 200 4030 - 6.196 ms
::1 - GET /index.css HTTP/1.1 304 - - 0.641 ms
::1 - GET /logo.png HTTP/1.1 304 - - 0.565 ms
::1 - GET /projectpage.bundle.js HTTP/1.1 304 - - 0.406 ms
(node:26522) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot 
set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:469:11)
    at ServerResponse.header (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:767:10)
    at ServerResponse.send (/Users/xiaoyun/LooseLeaf/Website/looseleaf-node/node_modules/express/lib/response.js:170:12)
    at /Users/xiaoyun/LooseLeaf/Website/looseleaf-node/client/iso-middleware/renderLandingApp.jsx:34:16
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26522) 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: 13)
xiaoyunyang commented 6 years ago

Check this out. Hope it helps.