cannot deploy from scratch
Closed this issue · 4 comments
Hey @syxolk , qatar is approaching and I love your app. But now for the first time since 2016 i cannot get it running. Tried it w ubuntu and on centos (where it ran before).
I cleared db and had a new one in the end foreach deployment. this knex thingy causes the main issues I assume.
Find attached some stacktraces, they may help...
error:
at Object.raw (/opt/kicktipp/qatar2022/node_modules/knex/lib/knex-builder/make-knex.js:115:30)
at Function.value (/opt/kicktipp/qatar2022/node_modules/knex/lib/knex-builder/make-knex.js:91:29)
at /opt/kicktipp/qatar2022/routes/middlewares.js:46:31
at handleReturn (/opt/kicktipp/qatar2022/node_modules/express-promise-router/lib/express-promise-router.js:24:23)
at /opt/kicktipp/qatar2022/node_modules/express-promise-router/lib/express-promise-router.js:64:7
at Layer.handle [as handle_request] (/opt/kicktipp/qatar2022/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/opt/kicktipp/qatar2022/node_modules/express/lib/router/index.js:317:13)
at /opt/kicktipp/qatar2022/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/opt/kicktipp/qatar2022/node_modules/express/lib/router/index.js:335:12)
at next (/opt/kicktipp/qatar2022/node_modules/express/lib/router/index.js:275:10)
at /opt/kicktipp/qatar2022/node_modules/express-promise-router/lib/express-promise-router.js:35:11
GET / 500 43.404 ms - 1334
(node:677) UnhandledPromiseRejectionWarning: error: with new_values (sid, expired, sess) as ( values ($1, $2::timestamp with time zone, $3::json)), upsert as ( update "session" cs set sid = nv.sid, expired = nv.expired, sess = nv.sess from new_values nv where cs.sid = nv.sid returning cs.* )insert into "session" (sid, expired, sess) select sid, expired, sess from new_values where not exists (select 1 from upsert up where up.sid = new_values.sid) - relation "session" does not exist
at Object.raw (/opt/kicktipp/qatar2022/node_modules/knex/lib/knex-builder/make-knex.js:115:30)
at Function.value (/opt/kicktipp/qatar2022/node_modules/knex/lib/knex-builder/make-knex.js:91:29)
at /opt/kicktipp/qatar2022/node_modules/connect-session-knex/lib/index.js:207:10
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:677) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:677) [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.
error: with new_values (sid, expired, sess) as ( values ($1, $2::timestamp with time zone, $3::json)), upsert as ( update "session" cs set sid = nv.sid, expired = nv.expired, sess = nv.sess from new_values nv where cs.sid = nv.sid returning cs.* )insert into "session" (sid, expired, sess) select sid, expired, sess from new_values where not exists (select 1 from upsert up where up.sid = new_values.sid) - relation "session" does not exist
at Object.raw (/opt/kicktipp/qatar2022/node_modules/knex/lib/knex-builder/make-knex.js:115:30)
at Function.value (/opt/kicktipp/qatar2022/node_modules/knex/lib/knex-builder/make-knex.js:91:29)
at /opt/kicktipp/qatar2022/node_modules/connect-session-knex/lib/index.js:207:10
at processTicksAndRejections (internal/process/task_queues.js:97:5)
thanks a lot for looking into it.
BR
Ok, so the actual error message seems to be this (just formatted for better readability):
with new_values (sid, expired, sess) as ( values ($1, $2::timestamp with time zone, $3::json)),
upsert as ( update "session" cs set sid = nv.sid, expired = nv.expired, sess = nv.sess
from new_values nv where cs.sid = nv.sid returning cs.* )
insert into "session" (sid, expired, sess) select sid, expired, sess
from new_values where not exists (select 1 from upsert up where up.sid = new_values.sid)
- relation "session" does not exist
I'm interested in your Node.js and Postgres Versions.
But most importantly, you have to run the database migrations to actually create all those database tables that are required. Please do this:
npm run migrate:latest
(It runs the migration files in the migrations
folder.)
Hey,
the node version is v12.22.12 and it's postgresql-9.4.
I never ran the migrate:latest.
The knexfile.js had to be altered - it does not take it from env vars correctly.
Now it worked. May I update the doc a little and file a PR for it?
thx a lot for helping out!
Now it worked.
Great to hear!
May I update the doc a little and file a PR for it?
Yeah, the Readme seems to be a bit outdated. You can help me here if you like.