erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
12k stars 2.5k forks source link

api server crashes on productuin when there is an node mysql error #1247

Open Ezekiah opened 8 years ago

Ezekiah commented 8 years ago

I have a crash of my api server when I get an error like " { Error: ER_NO_SUCH_TABLE: Table 'sts_infos.call_reasons2' doesn't exist"

Do you then why the api server get killed ? Can I prevent it to be killed when there is a fatal error ?

/home/webserv/www/server-sts/node_modules/mysql/lib/protocol/Parser.js:77 [1] throw err; // Rethrow non-MySQL errors [1] ^ [1] [1] TypeError: Cannot read property 'id' of undefined [1] at api.js:178:11 [1] at module.exports (connection.js:23:3) [1] at api.js:174:3 [1] at Query._callback (/home/webserv/www/server-sts/node_modules/express-mysql-session/lib/index.js:145:4) [1] at Query.Sequence.end (/home/webserv/www/server-sts/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24) [1] at Query._handleFinalResultPacket (/home/webserv/www/server-sts/node_modules/mysql/lib/protocol/sequences/Query.js:144:8) [1] at Query.EofPacket (/home/webserv/www/server-sts/node_modules/mysql/lib/protocol/sequences/Query.js:128:8) [1] at Protocol._parsePacket (/home/webserv/www/server-sts/node_modules/mysql/lib/protocol/Protocol.js:280:23) [1] at Parser.write (/home/webserv/www/server-sts/node_modules/mysql/lib/protocol/Parser.js:73:12) [1] at Protocol.write (/home/webserv/www/server-sts/node_modules/mysql/lib/protocol/Protocol.js:39:16) [1] [1] npm [1] ERR! Linux 3.2.0-4-amd64 [1] npm [1] ERR! argv [1] "/usr/bin/nodejs" "/usr/bin/npm" "run" "start-prod-api" [1] npm ERR! [1] node v6.3.0 [1] npm [1] ERR! npm v3.10.3 [1] npm ERR! [1] code ELIFECYCLE [1] npm ERR! react-redux-universal-hot-example@0.9.0 start-prod-api: better-npm-run start-prod-api [1] npm ERR! Exit status 1 [1] npm ERR! [1] npm ERR! Failed at the react-redux-universal-hot-example@0.9.0 start-prod-api script 'better-npm-run start-prod-api'. [1] npm ERR! Make sure you have the latest version of node.js and npm installed. [1] npm ERR! If you do, this is most likely a problem with the react-redux-universal-hot-example package, [1] npm ERR! not with npm itself. [1] npm ERR! Tell the author that this fails on your system: [1] npm ERR! better-npm-run start-prod-api [1] npm ERR! You can get information on how to open an issue for this project with: [1] npm ERR! npm bugs react-redux-universal-hot-example [1] npm [1] ERR! Or if that isn't available, you can get their info via: [1] npm ERR! npm owner ls react-redux-universal-hot-example [1] npm ERR! There is likely additional logging output above. [1] [1] npm ERR! [1] Please include the following file with any support request: [1] npm ERR! [1] /home/webserv/www/server-sts/npm-debug.log [1] npm run start-prod-api exited with code 1 [0] /home/webserv/www/server-sts/src/server.js:125 [0] res.writeHead(500, { 'content-type': 'application/json' }); [0] ^ [0] [0] TypeError: res.writeHead is not a function [0] at ProxyServer. (server.js:61:9) [0] at ProxyServer.emit (/home/webserv/www/server-sts/node_modules/eventemitter3/index.js:144:27) [0] at Socket.onOutgoingError (/home/webserv/www/server-sts/node_modules/http-proxy/lib/http-proxy/passes/ws-incoming.js:153:16) [0] at emitOne (events.js:101:20) [0] at Socket.emit (events.js:188:7) [0] at emitErrorNT (net.js:1272:8) [0] at _combinedTickCallback (internal/process/next_tick.js:74:11) [0] at process._tickCallback (internal/process/next_tick.js:98:9) [0] [0] npm [0] ERR! Linux 3.2.0-4-amd64 [0] npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "start-prod" [0] npm [0] ERR! node v6.3.0 [0] npm ERR! npm v3.10.3 [0] npm ERR! code ELIFECYCLE [0] npm ERR! react-redux-universal-hot-example@0.9.0 start-prod: better-npm-run start-prod [0] npm ERR! Exit status 1 [0] npm ERR! [0] npm ERR! Failed at the react-redux-universal-hot-example@0.9.0 start-prod script 'better-npm-run start-prod'. [0] npm ERR! Make sure you have the latest version of node.js and npm installed. [0] npm ERR! If you do, this is most likely a problem with the react-redux-universal-hot-example package, [0] npm ERR! not with npm itself. [0] npm ERR! Tell the author that this fails on your system: [0] npm ERR! [0] better-npm-run start-prod [0] npm ERR! You can get information on how to open an issue for this project with: [0] npm ERR! npm bugs react-redux-universal-hot-example [0] npm ERR! Or if that isn't available, you can get their info via: [0] npm ERR! npm owner ls react-redux-universal-hot-example [0] npm ERR! There is likely additional logging output above. [0] [0] npm ERR! Please include the following file with any support request: [0] npm ERR! /home/webserv/www/server-sts/npm-debug.log [0] npm run start-prod exited with code 1

npm ERR! Linux 3.2.0-4-amd64 npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "start" "--prefix=/home/webserv/www/server-sts/" npm ERR! node v6.3.0 npm ERR! npm v3.10.3 npm ERR! code ELIFECYCLE npm ERR! react-redux-universal-hot-example@0.9.0 start: concurrent --kill-others "npm run start-prod" "npm run start-prod-api" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the react-redux-universal-hot-example@0.9.0 start script 'concurrent --kill-others "npm run start-prod" "npm run start-prod-api"'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the react-redux-universal-hot-example package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! concurrent --kill-others "npm run start-prod" "npm run start-prod-api" npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs react-redux-universal-hot-example npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls react-redux-universal-hot-example npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /root/npm-debug.log

jdosullivan commented 8 years ago

The very definition of the word fatal means it shouldn't be coming back. Either fix the error or use a try/catch around the code in question.