docker icon indicating copy to clipboard operation
docker copied to clipboard

The table `public.users` does not exist in the current database

Open zerotraceme opened this issue 3 years ago • 3 comments

After building calendso on my server and getting access to both the page as well as the studio, I got this error when loading studio and also when trying to add a user.

After successfully building it I saw the error initdb: error: could not create directory "/var/lib/postgresql/data/pg_wal": No space left on device, so I did a docker system prune --all --volumes to free up space and that seems to have worked.

But maybe that's already why it fails, not sure...

Message: Error in Prisma Client request: 

Invalid `prisma.user.findMany()` invocation:
  The table `public.users` does not exist in the current database.
  
Query:
prisma.user.findMany({
  take: 100,
  skip: 0,
  select: {
    id: true,
    username: true,
    name: true,
    email: true,
    emailVerified: true,
    password: true,
    bio: true,
    avatar: true,
    timeZone: true,
    weekStart: true,
    startTime: true,
    endTime: true,
    bufferTime: true,
    hideBranding: true,
    theme: true,
    createdDate: true,
    eventTypes: true,
    credentials: true,
    teams: true,
    bookings: true,
    availability: true,
    selectedCalendars: true,
    completedOnboarding: true,
    locale: true,
    twoFactorSecret: true,
    twoFactorEnabled: true,
    identityProvider: true,
    identityProviderId: true,
    invitedTo: true,
    plan: true,
    Schedule: true,
    webhooks: true,
    brandColor: true,
    destinationCalendar: true,
    away: true,
    metadata: true,
    verified: true,
  }
})

Here is some output from running docker-compose up --build after running into the dbinit error repeatedly: Not sure why it shuts down multiple times... Maybe somebody knows why I get this! I'll also try upgrading my server, but that shouldn't be it I guess...

...
database_1  | The files belonging to this database system will be owned by user "postgres".
database_1  | This user must also own the server process.
database_1  | 
database_1  | The database cluster will be initialized with locale "en_US.utf8".
database_1  | The default database encoding has accordingly been set to "UTF8".
database_1  | The default text search configuration will be set to "english".
database_1  | 
database_1  | Data page checksums are disabled.
database_1  | 
database_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
database_1  | initdb: error: could not create directory "/var/lib/postgresql/data/pg_wal": No space left on device
database_1  | initdb: removing contents of data directory "/var/lib/postgresql/data"
calcom_database_1 exited with code 1
calendso_1  | @calcom/web:start: (node:170) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
calendso_1  | @calcom/web:start: (Use `node --trace-warnings ...` to show where the warning was created)
database_1  | The files belonging to this database system will be owned by user "postgres".
database_1  | This user must also own the server process.
database_1  | 
database_1  | The database cluster will be initialized with locale "en_US.utf8".
database_1  | The default database encoding has accordingly been set to "UTF8".
database_1  | The default text search configuration will be set to "english".
database_1  | 
database_1  | Data page checksums are disabled.
database_1  | 
database_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
database_1  | initdb: error: could not create directory "/var/lib/postgresql/data/pg_wal": No space left on device
database_1  | initdb: removing contents of data directory "/var/lib/postgresql/data"
calcom_database_1 exited with code 1
database_1  | The files belonging to this database system will be owned by user "postgres".
database_1  | This user must also own the server process.
database_1  | 
database_1  | The database cluster will be initialized with locale "en_US.utf8".
database_1  | The default database encoding has accordingly been set to "UTF8".
database_1  | The default text search configuration will be set to "english".
database_1  | 
database_1  | Data page checksums are disabled.
database_1  | 
database_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
database_1  | creating subdirectories ... ok
database_1  | selecting dynamic shared memory implementation ... posix
database_1  | selecting default max_connections ... 100
database_1  | selecting default shared_buffers ... 128MB
database_1  | selecting default time zone ... Etc/UTC
database_1  | creating configuration files ... ok
database_1  | running bootstrap script ... ok
database_1  | performing post-bootstrap initialization ... ok
database_1  | syncing data to disk ... ok
database_1  | 
database_1  | initdb: warning: enabling "trust" authentication for local connections
database_1  | You can change this by editing pg_hba.conf or using the option -A, or
database_1  | --auth-local and --auth-host, the next time you run initdb.
database_1  | 
database_1  | Success. You can now start the database server using:
database_1  | 
database_1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
database_1  | 
database_1  | waiting for server to start....2022-02-22 18:52:16.027 UTC [48] LOG:  starting PostgreSQL 14.2 (Debian 14.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
database_1  | 2022-02-22 18:52:16.029 UTC [48] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
database_1  | 2022-02-22 18:52:16.036 UTC [49] LOG:  database system was shut down at 2022-02-22 18:52:15 UTC
database_1  | 2022-02-22 18:52:16.044 UTC [48] LOG:  database system is ready to accept connections
database_1  |  done
database_1  | server started
database_1  | CREATE DATABASE
database_1  | 
database_1  | 
database_1  | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
database_1  | 
database_1  | 2022-02-22 18:52:16.406 UTC [48] LOG:  received fast shutdown request
database_1  | waiting for server to shut down....2022-02-22 18:52:16.408 UTC [48] LOG:  aborting any active transactions
database_1  | 2022-02-22 18:52:16.414 UTC [48] LOG:  background worker "logical replication launcher" (PID 55) exited with exit code 1
database_1  | 2022-02-22 18:52:16.416 UTC [50] LOG:  shutting down
database_1  | 2022-02-22 18:52:16.426 UTC [48] LOG:  database system is shut down
database_1  |  done
database_1  | server stopped
database_1  | 
database_1  | PostgreSQL init process complete; ready for start up.
database_1  | 
database_1  | 2022-02-22 18:52:16.553 UTC [1] LOG:  starting PostgreSQL 14.2 (Debian 14.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
database_1  | 2022-02-22 18:52:16.554 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
database_1  | 2022-02-22 18:52:16.555 UTC [1] LOG:  listening on IPv6 address "::", port 5432
database_1  | 2022-02-22 18:52:16.557 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
database_1  | 2022-02-22 18:52:16.562 UTC [62] LOG:  database system was shut down at 2022-02-22 18:52:16 UTC
database_1  | 2022-02-22 18:52:16.567 UTC [1] LOG:  database system is ready to accept connections
database_1  | 2022-02-22 18:54:15.451 UTC [72] ERROR:  relation "public.EventType" does not exist at character 61
database_1  | 2022-02-22 18:54:15.451 UTC [72] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."EventType"."id" FROM "public"."EventType" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.530 UTC [70] ERROR:  relation "public.users" does not exist at character 57
database_1  | 2022-02-22 18:54:15.530 UTC [70] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."users"."id" FROM "public"."users" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.535 UTC [71] ERROR:  relation "public.users" does not exist at character 849
database_1  | 2022-02-22 18:54:15.535 UTC [71] STATEMENT:  SELECT "public"."users"."id", "public"."users"."username", "public"."users"."name", "public"."users"."email", "public"."users"."emailVerified", "public"."users"."password", "public"."users"."bio", "public"."users"."avatar", "public"."users"."timeZone", "public"."users"."weekStart", "public"."users"."startTime", "public"."users"."endTime", "public"."users"."bufferTime", "public"."users"."hideBranding", "public"."users"."theme", "public"."users"."created", "public"."users"."completedOnboarding", "public"."users"."locale", "public"."users"."twoFactorSecret", "public"."users"."twoFactorEnabled", "public"."users"."identityProvider", "public"."users"."identityProviderId", "public"."users"."invitedTo", "public"."users"."plan", "public"."users"."brandColor", "public"."users"."away", "public"."users"."metadata", "public"."users"."verified" FROM "public"."users" WHERE 1=1 ORDER BY "public"."users"."id" ASC LIMIT $1 OFFSET $2
database_1  | 2022-02-22 18:54:15.590 UTC [73] ERROR:  relation "public.Credential" does not exist at character 62
database_1  | 2022-02-22 18:54:15.590 UTC [73] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Credential"."id" FROM "public"."Credential" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.638 UTC [74] ERROR:  relation "public.DestinationCalendar" does not exist at character 71
database_1  | 2022-02-22 18:54:15.638 UTC [74] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."DestinationCalendar"."id" FROM "public"."DestinationCalendar" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.640 UTC [73] ERROR:  relation "public.users" does not exist at character 57
database_1  | 2022-02-22 18:54:15.640 UTC [73] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."users"."id" FROM "public"."users" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.641 UTC [72] ERROR:  relation "public.Team" does not exist at character 56
database_1  | 2022-02-22 18:54:15.641 UTC [72] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Team"."id" FROM "public"."Team" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.645 UTC [72] ERROR:  relation "public.Membership" does not exist at character 98
database_1  | 2022-02-22 18:54:15.645 UTC [72] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Membership"."userId", "public"."Membership"."teamId" FROM "public"."Membership" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.647 UTC [74] ERROR:  relation "public.VerificationRequest" does not exist at character 71
database_1  | 2022-02-22 18:54:15.647 UTC [74] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."VerificationRequest"."id" FROM "public"."VerificationRequest" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.649 UTC [73] ERROR:  relation "public.BookingReference" does not exist at character 68
database_1  | 2022-02-22 18:54:15.649 UTC [73] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."BookingReference"."id" FROM "public"."BookingReference" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.651 UTC [73] ERROR:  relation "public.Attendee" does not exist at character 60
database_1  | 2022-02-22 18:54:15.651 UTC [73] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Attendee"."id" FROM "public"."Attendee" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.652 UTC [72] ERROR:  relation "public.DailyEventReference" does not exist at character 71
database_1  | 2022-02-22 18:54:15.652 UTC [72] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."DailyEventReference"."id" FROM "public"."DailyEventReference" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.654 UTC [74] ERROR:  relation "public.Booking" does not exist at character 59
database_1  | 2022-02-22 18:54:15.654 UTC [74] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Booking"."id" FROM "public"."Booking" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.655 UTC [74] ERROR:  relation "public.Schedule" does not exist at character 60
database_1  | 2022-02-22 18:54:15.655 UTC [74] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Schedule"."id" FROM "public"."Schedule" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.681 UTC [73] ERROR:  relation "public.Availability" does not exist at character 64
database_1  | 2022-02-22 18:54:15.681 UTC [73] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Availability"."id" FROM "public"."Availability" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.681 UTC [72] ERROR:  relation "public.SelectedCalendar" does not exist at character 157
database_1  | 2022-02-22 18:54:15.681 UTC [72] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."SelectedCalendar"."userId", "public"."SelectedCalendar"."integration", "public"."SelectedCalendar"."externalId" FROM "public"."SelectedCalendar" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.682 UTC [72] ERROR:  relation "public.EventTypeCustomInput" does not exist at character 72
database_1  | 2022-02-22 18:54:15.682 UTC [72] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."EventTypeCustomInput"."id" FROM "public"."EventTypeCustomInput" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.683 UTC [74] ERROR:  relation "public.ResetPasswordRequest" does not exist at character 72
database_1  | 2022-02-22 18:54:15.683 UTC [74] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."ResetPasswordRequest"."id" FROM "public"."ResetPasswordRequest" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.684 UTC [73] ERROR:  relation "public.ReminderMail" does not exist at character 64
database_1  | 2022-02-22 18:54:15.684 UTC [73] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."ReminderMail"."id" FROM "public"."ReminderMail" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.684 UTC [73] ERROR:  relation "public.Payment" does not exist at character 59
database_1  | 2022-02-22 18:54:15.684 UTC [73] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Payment"."id" FROM "public"."Payment" WHERE 1=1 OFFSET $1) AS "sub"
database_1  | 2022-02-22 18:54:15.685 UTC [72] ERROR:  relation "public.Webhook" does not exist at character 59
database_1  | 2022-02-22 18:54:15.685 UTC [72] STATEMENT:  SELECT COUNT(*) FROM (SELECT "public"."Webhook"."id" FROM "public"."Webhook" WHERE 1=1 OFFSET $1) AS "sub"

zerotraceme avatar Feb 22 '22 19:02 zerotraceme

@leprodude Running into the same issue. Did you solve it?

tholu avatar Apr 07 '22 12:04 tholu

@tholu Unfortunately not! I decided to let them sort a bit more of the codebase change before I tackle it again.

zerotraceme avatar Apr 07 '22 12:04 zerotraceme

This was an issue where the latest calendso/calendso image which the studio service uses was an old version which did not match the current schema version. (so a schema mismatch).

Please docker-compose pull and clone latest, should be good to go

krumware avatar Apr 29 '22 19:04 krumware