vendure-ecommerce / vendure-docker-compose

A containerized Vendure server and storefront
MIT License
33 stars 37 forks source link

worker fails to start: relation "zone" does not exist #6

Closed tpimh closed 3 years ago

tpimh commented 3 years ago

Here is the log from worker container:

wait-for-it.sh: waiting 15 seconds for database:5432
wait-for-it.sh: database:5432 is available after 0 seconds
yarn run v1.22.5
$ node dist/index-worker.js
Copied email templates to /usr/src/app/node_modules/@vendure/email-plugin/templates
info 7/14/21, 1:22 PM - [Vendure Worker] Bootstrapping Vendure Worker (pid: 41)... 
QueryFailedError: relation "zone" does not exist
    at new QueryFailedError (/usr/src/app/node_modules/typeorm/error/QueryFailedError.js:11:28)
    at PostgresQueryRunner.<anonymous> (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:247:31)
    at step (/usr/src/app/node_modules/typeorm/node_modules/tslib/tslib.js:141:27)
    at Object.throw (/usr/src/app/node_modules/typeorm/node_modules/tslib/tslib.js:122:57)
    at rejected (/usr/src/app/node_modules/typeorm/node_modules/tslib/tslib.js:113:69)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  length: 104,
  severity: 'ERROR',
  code: '42P01',
  detail: undefined,
  hint: undefined,
  position: '890',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_relation.c',
  line: '1376',
  routine: 'parserOpenTable',
  query: 'SELECT "Zone"."createdAt" AS "Zone_createdAt", "Zone"."updatedAt" AS "Zone_updatedAt", "Zone"."name" AS "Zone_name", "Zone"."id" AS "Zone_id", "Zone__members"."createdAt" AS "Zone__members_createdAt", "Zone__members"."updatedAt" AS "Zone__members_updatedAt", "Zone__members"."code" AS "Zone__members_code", "Zone__members"."enabled" AS "Zone__members_enabled", "Zone__members"."id" AS "Zone__members_id", "Zone__members_translations"."createdAt" AS "Zone__members_translations_createdAt", "Zone__members_translations"."updatedAt" AS "Zone__members_translations_updatedAt", "Zone__members_translations"."languageCode" AS "Zone__members_translations_languageCode", "Zone__members_translations"."name" AS "Zone__members_translations_name", "Zone__members_translations"."id" AS "Zone__members_translations_id", "Zone__members_translations"."baseId" AS "Zone__members_translations_baseId" FROM "zone" "Zone" LEFT JOIN "zone_members_country" "Zone_Zone__members" ON "Zone_Zone__members"."zoneId"="Zone"."id" LEFT JOIN "country" "Zone__members" ON "Zone__members"."id"="Zone_Zone__members"."countryId"  LEFT JOIN "country_translation" "Zone__members_translations" ON "Zone__members_translations"."baseId"="Zone__members"."id"',
  parameters: []
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This only happens on the initial bringup, if started later it works correctly. Also, it's impossible to tell if the worker is dead without checking the container status. Could it possibly be added to the health report?

michaelbromley commented 3 years ago

Hi!

Thanks for the report. I just implemented a fix for this which will be included in the next release (1.1.1).

Regarding health checks on the worker, I am looking into that. The worker has no http layer, so I'm not sure of the best way to do it - I've asked in the NestJS discord and I'll see whether there's a good way to do it.

michaelbromley commented 3 years ago

I've created a separate issue about health checks: https://github.com/vendure-ecommerce/vendure/issues/994

So I'll close this one now.