kouprlabs / voltaserve

⚡️ Cloud Storage for Creators
https://voltaserve.com
Other
257 stars 14 forks source link

Initial account registration fails. #115

Open dalso0418 opened 3 months ago

dalso0418 commented 3 months ago

As in the example, when you set up the .env and docker-compose.yml files to create a container Web access is possible, but the following error occurs when creating an account.

image

voltaserve-meilisearch-1 | 2024-07-05T09:15:49.463378Z INFO HTTP request{method=GET host="127.0.0.1:7700" route=/health query_parameters= user_agent=curl/8.5.0 status_code=200}: meilisearch: close time.busy=543µs time.idle=19.1µs voltaserve-idp-1 | 521 | result = new this._Promise((resolve, reject) => { voltaserve-idp-1 | 522 | query.callback = (err, res) => (err ? reject(err) : resolve(res)) voltaserve-idp-1 | 523 | }).catch((err) => { voltaserve-idp-1 | 524 | // replace the stack trace that leads to TCP.onStreamRead with one that leads back to the voltaserve-idp-1 | 525 | // application that created the query voltaserve-idp-1 | 526 | Error.captureStackTrace(err) voltaserve-idp-1 | ^ voltaserve-idp-1 | error: relation "user" does not exist voltaserve-idp-1 | code: "42P01" voltaserve-idp-1 | voltaserve-idp-1 | at /app/node_modules/pg/lib/client.js:526:17 voltaserve-idp-1 | at processTicksAndRejections (native:1:1) voltaserve-idp-1 | voltaserve-idp-1 | POST /v2/accounts - 30.180 ms - - voltaserve-idp-1 | Error: relation "user" does not exist voltaserve-idp-1 | at (/app/node_modules/pg/lib/client.js:526:17) voltaserve-idp-1 | at processTicksAndRejections (native) voltaserve-meilisearch-1 | 2024-07-05T09:16:19.518755Z INFO HTTP request{method=GET host="127.0.0.1:7700" route=/health query_parameters= user_agent=curl/8

bouassaba commented 3 months ago

@dalso0418 I have a question regarding the steps you followed, does it look like this?

  1. Clone the Git repository: git clone https://github.com/kouprlabs/voltaserve.git
  2. While inside the repository folder, download and start the containers: docker-compose up -d
loboda4450 commented 2 months ago

This issue is related to wrongly created tables in database. Try adding these queries here

CREATE USER voltaserve CREATEDB NOCREATEROLE;
SET ROLE voltaserve;
CREATE DATABASE voltaserve;
SET ROLE root;
ALTER USER voltaserve NOCREATEDB;
GRANT ALL ON DATABASE voltaserve TO voltaserve;
SET ROLE voltaserve;
bouassaba commented 1 month ago

@dalso0418 could you please confirm if the issue has been solved on your side? Thanks.

stancubed commented 1 month ago

I'm also having this issue and getting relation "user" does not exist. I tried connecting directly to postgres and running the above queries but it hasn't resolved the issue.

error: relation "user" does not exist
    at /app/node_modules/pg/lib/client.js:526:17
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UserRepoImpl.isUsernameAvailable (/app/src/user/repo.ts:131:26)
    at async createUser (/app/src/account/service.ts:53:9)
    at async /app/src/account/router.ts:48:16 {
  length: 103,
  severity: 'ERROR',
  code: '42P01',
  detail: undefined,
  hint: undefined,
  position: '15',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_relation.c',
  line: '1449',
  routine: 'parserOpenTable'
}
POST /v2/accounts 500 13.324 ms - 201
error: relation "user" does not exist
    at /app/node_modules/pg/lib/client.js:526:17
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UserRepoImpl.isUsernameAvailable (/app/src/user/repo.ts:131:26)
    at async createUser (/app/src/account/service.ts:53:9)
    at async /app/src/account/router.ts:48:16

I ran the following command to list all tables since I didn't see them in postgres and it seems like the tables weren't created?

SELECT table_schema,table_name
FROM information_schema.tables
ORDER BY table_schema,table_name;

Results:

(edited since the solve wasn't related to the default tables -- see my next comment!)
stancubed commented 1 month ago

Ah, you know as soon as I posted this, I figured it out. To put this behind my reverse proxy, I put all of the containers on a network and only add the containers that need to be reached from the outside to the shared bridge network with my reverse proxy. I hadn't added a network to the migrations container because it didn't have any exposed ports. So it couldn't see postgres and was panicking due to connection errors.

So @dalso0418 maybe check the logs from migrations and see if it wasn't able to connect and apply the SQL migrations?