Heroku的托管错误(Node / Express / PostgreSQL)

布拉德利

我正在尝试使用Express / PostgresSQL / Bookshelf / Knex在Node中创建的Heroku托管我的后端,但是我遇到了错误,这是第一次在Node中托管某些东西。

完整的Heroku日志:

2016-12-31T20:31:29.069373+00:00 app[web.1]:     at loader (/app/node_modules/babel-register/lib/node.js:144:5)
2016-12-31T20:31:29.069374+00:00 app[web.1]:     at Object.require.extensions.(anonymous function) [as .js] (/app/node_modules/babel-register/lib/node.js:154:7)
2016-12-31T20:31:29.069375+00:00 app[web.1]:     at Module.load (module.js:487:32)
2016-12-31T20:31:29.069375+00:00 app[web.1]:     at tryModuleLoad (module.js:446:12)
2016-12-31T20:31:29.069376+00:00 app[web.1]:     at Function.Module._load (module.js:438:3)
 2016-12-31T20:31:29.078379+00:00 app[web.1]: [nodemon] app crashed - waiting for file changes before starting...
2016-12-31T20:32:25.362589+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-12-31T20:32:25.362722+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-12-31T20:32:25.490163+00:00 heroku[web.1]: Process exited with status 137
2016-12-31T20:32:25.503103+00:00 heroku[web.1]: State changed from starting to crashed
2016-12-31T20:34:22.986995+00:00 heroku[slug-compiler]: Slug compilation started
2016-12-31T20:34:22.987007+00:00 heroku[slug-compiler]: Slug compilation finished
2016-12-31T20:34:22.808949+00:00 app[api]: Release v14 created by user [email protected]
2016-12-31T20:34:22.808949+00:00 app[api]: Deploy aabe7e2 by user [email protected]
2016-12-31T20:34:23.154490+00:00 heroku[web.1]: State changed from crashed to starting
2016-12-31T20:34:25.399465+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-31T20:34:28.313447+00:00 app[web.1]: 
2016-12-31T20:34:28.313461+00:00 app[web.1]: > [email protected] start /app
2016-12-31T20:34:28.313462+00:00 app[web.1]: > nodemon --watch src --exec babel-node -- src/index.js
2016-12-31T20:34:28.313463+00:00 app[web.1]: 
2016-12-31T20:34:28.674900+00:00 app[web.1]: [nodemon] 1.11.0
2016-12-31T20:34:28.676312+00:00 app[web.1]: [nodemon] to restart at any time, enter `rs`
2016-12-31T20:34:28.676716+00:00 app[web.1]: [nodemon] watching: /app/src/**/*
2016-12-31T20:34:28.677296+00:00 app[web.1]: [nodemon] starting `babel-node src/index.js`
2016-12-31T20:34:30.799714+00:00 app[web.1]: It's aliiive!
2016-12-31T20:34:31.191662+00:00 heroku[web.1]: State changed from starting to up
2016-12-31T20:34:33.199781+00:00 app[web.1]: Unhandled rejection error: select "workouts".* from "workouts" where "user_id" = $1 - relation "workouts" does not exist
2016-12-31T20:34:33.199799+00:00 app[web.1]:     at Connection.parseE (/app/node_modules/pg/lib/connection.js:554:11)
2016-12-31T20:34:33.199800+00:00 app[web.1]:     at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:381:17)
2016-12-31T20:34:33.199800+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:117:22)
2016-12-31T20:34:33.199801+00:00 app[web.1]:     at emitOne (events.js:96:13)
2016-12-31T20:34:33.199802+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
2016-12-31T20:34:33.199803+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2016-12-31T20:34:33.199803+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
2016-12-31T20:34:33.199804+00:00 app[web.1]:     at TCP.onread (net.js:548:20)
2016-12-31T20:34:32.721170+00:00 app[web.1]:     at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:381:17)
2016-12-31T20:34:32.721171+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:117:22)
2016-12-31T20:34:32.721173+00:00 app[web.1]:     at emitOne (events.js:96:13)
2016-12-31T20:34:32.721153+00:00 app[web.1]: Unhandled rejection error: select "workouts".* from "workouts" where "user_id" = $1 - relation "workouts" does not exist
2016-12-31T20:34:32.721169+00:00 app[web.1]:     at Connection.parseE (/app/node_modules/pg/lib/connection.js:554:11)
2016-12-31T20:34:32.721174+00:00 app[web.1]:     at Socket.emit (events.js:188:7)
2016-12-31T20:34:32.721174+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:176:18)
2016-12-31T20:34:32.721175+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:134:10)
2016-12-31T20:34:32.721176+00:00 app[web.1]:     at TCP.onread (net.js:548:20)
2016-12-31T20:35:02.683518+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/workouts/1" host=i-workout.herokuapp.com request_id=fc21163c-5df0-43f0-9572-fa7b16d6c1ab fwd="216.40.82.105" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0
2016-12-31T20:35:03.191102+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/workouts/1" host=i-workout.herokuapp.com request_id=2ffe1393-8fce-4d88-8d14-b1b390037bc7 fwd="216.40.82.105" dyno=web.1 connect=1ms service=30001ms status=503 bytes=0
2016-12-31T20:44:07.901256+00:00 heroku[slug-compiler]: Slug compilation started
2016-12-31T20:44:07.901266+00:00 heroku[slug-compiler]: Slug compilation finished
2016-12-31T20:44:07.759224+00:00 app[api]: Release v15 created by user [email protected]
2016-12-31T20:44:07.759224+00:00 app[api]: Deploy 5a9ad8c by user [email protected]
2016-12-31T20:44:08.078676+00:00 heroku[web.1]: Restarting
2016-12-31T20:44:08.079167+00:00 heroku[web.1]: State changed from up to starting
2016-12-31T20:44:08.539241+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-12-31T20:44:08.703155+00:00 heroku[web.1]: Process exited with status 143
2016-12-31T20:44:09.967148+00:00 heroku[web.1]: Starting process with command `npm start`
2016-12-31T20:44:12.242286+00:00 app[web.1]: 
2016-12-31T20:44:12.242298+00:00 app[web.1]: > [email protected] start /app
2016-12-31T20:44:12.242298+00:00 app[web.1]: > nodemon --watch src --exec babel-node -- src/index.js
2016-12-31T20:44:12.242299+00:00 app[web.1]: 
2016-12-31T20:44:12.537954+00:00 app[web.1]: [nodemon] 1.11.0
2016-12-31T20:44:12.539225+00:00 app[web.1]: [nodemon] to restart at any time, enter `rs`
2016-12-31T20:44:12.539611+00:00 app[web.1]: [nodemon] watching: /app/src/**/*
2016-12-31T20:44:12.540118+00:00 app[web.1]: [nodemon] starting `babel-node src/index.js`
2016-12-31T20:44:14.323564+00:00 app[web.1]: It's aliiive!
2016-12-31T20:44:14.981609+00:00 heroku[web.1]: State changed from starting to up
2016-12-31T20:44:16.574010+00:00 app[web.1]:     at /app/node_modules/knex/src/client.js:210:25
2016-12-31T20:44:16.574012+00:00 app[web.1]:     at Promise._execute (/app/node_modules/bluebird/js/release/debuggability.js:300:9)
2016-12-31T20:44:16.574013+00:00 app[web.1]:     at Promise._resolveFromExecutor (/app/node_modules/bluebird/js/release/promise.js:481:18)
2016-12-31T20:44:16.573992+00:00 app[web.1]: Unhandled rejection Error: There is no pool defined on the current client
2016-12-31T20:44:16.574013+00:00 app[web.1]:     at Client.acquireConnection (/app/node_modules/knex/src/client.js:208:23)
2016-12-31T20:44:16.574013+00:00 app[web.1]:     at new Promise (/app/node_modules/bluebird/js/release/promise.js:77:14)
2016-12-31T20:44:16.574015+00:00 app[web.1]:     at Promise._resolveFromExecutor (/app/node_modules/bluebird/js/release/promise.js:481:18)
2016-12-31T20:44:16.574016+00:00 app[web.1]:     at new Promise (/app/node_modules/bluebird/js/release/promise.js:77:14)
2016-12-31T20:44:16.574014+00:00 app[web.1]:     at /app/node_modules/knex/src/runner.js:188:49
2016-12-31T20:44:16.574016+00:00 app[web.1]:     at /app/node_modules/knex/src/runner.js:187:35
2016-12-31T20:44:16.574014+00:00 app[web.1]:     at Promise._execute (/app/node_modules/bluebird/js/release/debuggability.js:300:9)
2016-12-31T20:44:16.574017+00:00 app[web.1]:     at Function.Promise.attempt.Promise.try (/app/node_modules/bluebird/js/release/method.js:39:29)
 2016-12-31T20:44:16.574018+00:00 app[web.1]:     at Runner.ensureConnection (/app/node_modules/knex/src/runner.js:186:23)
2016-12-31T20:44:16.574018+00:00 app[web.1]:     at Runner.run (/app/node_modules/knex/src/runner.js:27:31)
2016-12-31T20:44:16.574018+00:00 app[web.1]:     at QueryBuilder.Target.then (/app/node_modules/knex/src/interface.js:22:45)
2016-12-31T20:44:16.574017+00:00 app[web.1]:     at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
2016-12-31T20:44:16.574019+00:00 app[web.1]:     at QueryBuilder.tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
2016-12-31T20:44:16.025272+00:00 app[web.1]: Unhandled rejection Error: There is no pool defined on the current client
2016-12-31T20:44:16.025287+00:00 app[web.1]:     at /app/node_modules/knex/src/client.js:210:25
2016-12-31T20:44:16.025288+00:00 app[web.1]:     at Promise._execute (/app/node_modules/bluebird/js/release/debuggability.js:300:9)
2016-12-31T20:44:16.025289+00:00 app[web.1]:     at Promise._resolveFromExecutor (/app/node_modules/bluebird/js/release/promise.js:481:18)
2016-12-31T20:44:16.025289+00:00 app[web.1]:     at new Promise (/app/node_modules/bluebird/js/release/promise.js:77:14)
2016-12-31T20:44:16.025290+00:00 app[web.1]:     at Client.acquireConnection (/app/node_modules/knex/src/client.js:208:23)
2016-12-31T20:44:16.025291+00:00 app[web.1]:     at /app/node_modules/knex/src/runner.js:188:49
2016-12-31T20:44:16.025292+00:00 app[web.1]:     at Promise._execute (/app/node_modules/bluebird/js/release/debuggability.js:300:9)
2016-12-31T20:44:16.025292+00:00 app[web.1]:     at Promise._resolveFromExecutor (/app/node_modules/bluebird/js/release/promise.js:481:18)
2016-12-31T20:44:16.025293+00:00 app[web.1]:     at new Promise (/app/node_modules/bluebird/js/release/promise.js:77:14)
2016-12-31T20:44:16.025293+00:00 app[web.1]:     at /app/node_modules/knex/src/runner.js:187:35
2016-12-31T20:44:16.025294+00:00 app[web.1]:     at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
2016-12-31T20:44:16.025295+00:00 app[web.1]:     at Function.Promise.attempt.Promise.try (/app/node_modules/bluebird/js/release/method.js:39:29)
2016-12-31T20:44:16.025296+00:00 app[web.1]:     at Runner.ensureConnection (/app/node_modules/knex/src/runner.js:186:23)
2016-12-31T20:44:16.025296+00:00 app[web.1]:     at Runner.run (/app/node_modules/knex/src/runner.js:27:31)
2016-12-31T20:44:16.025297+00:00 app[web.1]:     at QueryBuilder.Target.then (/app/node_modules/knex/src/interface.js:22:45)
2016-12-31T20:44:16.025298+00:00 app[web.1]:     at QueryBuilder.tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
2016-12-31T20:44:45.977575+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/workouts/1" host=i-workout.herokuapp.com request_id=89f31a97-e35f-4aaa-b16a-a9d669adf0bf fwd="216.40.82.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
2016-12-31T20:44:46.569114+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/api/workouts/1" host=i-workout.herokuapp.com request_id=02919f3b-50ec-48aa-8dd9-6e5df0def5f4 fwd="216.40.82.105" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0

github仓库:https : //github.com/bcravens/WorkoutsServer

安德烈斯·安德拉德

似乎您的应用未设置用于生产。尝试更改您的knexfile以用于生产:

production: {
    client: 'postgresql',
    connection: process.env.HEROKU_POSTGRESQL_URL, // env var
    },
    pool: {
      min: 2,
      max: 10
    },
    migrations: {
      tableName: 'knex_migrations'
    }
}

然后您将书架归档到:

export default bookshelf(knex(knexConfig.production))

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

Related 相关文章

热门标签

归档