[BUG] user_id is actually username
SQLAl;chemy returns an error
SQLAlchemy error
open-assistant-inference-db-1 | 2023-04-19 11:31:22.491 UTC [48] ERROR: insert or update on table "chat" violates foreign key constraint "chat_user_id_fkey"
open-assistant-inference-db-1 | 2023-04-19 11:31:22.491 UTC [48] DETAIL: Key (user_id)=(devddd) is not present in table "user".
open-assistant-inference-db-1 | 2023-04-19 11:31:22.491 UTC [48] STATEMENT: INSERT INTO chat (hidden, id, user_id, created_at, modified_at, title) VALUES ($1::bool, $2::varchar, $3::varchar, $4::timestamp, $5::timestamp, $6::varchar)
open-assistant-inference-server-1 | 2023-04-19 11:31:22.492 | ERROR | main:log_exceptions:36 - Exception in request
open-assistant-inference-server-1 | Traceback (most recent call last):
open-assistant-inference-server-1 |
open-assistant-inference-server-1 | File "/var/opt/inference/server/lib/sqlalchemy/dialects/postgresql/asyncpg.py", line 442, in _prepare_and_execute
open-assistant-inference-server-1 | self._rows = await prepared_stmt.fetch(*parameters)
open-assistant-inference-server-1 | │ │ │ │ └ (False, '0643fd10-a7d4-7ff1-8000-5600ec2bf3d8', 'devddd', datetime.datetime(2023, 4, 19, 11, 31, 22, 489515), datetime.dateti...
open-assistant-inference-server-1 | │ │ │ └ <function PreparedStatement.fetch at 0x7f1ff4fd00d0>
open-assistant-inference-server-1 | │ │ └ <asyncpg.prepared_stmt.PreparedStatement object at 0x7f1ff0ace2a0>
open-assistant-inference-server-1 | │ └ <member '_rows' of 'AsyncAdapt_asyncpg_cursor' objects>
open-assistant-inference-server-1 | └ <sqlalchemy.dialects.postgresql.asyncpg.AsyncAdapt_asyncpg_cursor object at 0x7f1ff1384200>
open-assistant-inference-server-1 |
open-assistant-inference-server-1 | File "/var/opt/inference/server/lib/asyncpg/prepared_stmt.py", line 176, in fetch
open-assistant-inference-server-1 | data = await self.__bind_execute(args, 0, timeout)
open-assistant-inference-server-1 | │ │ └ None
open-assistant-inference-server-1 | │ └ (False, '0643fd10-a7d4-7ff1-8000-5600ec2bf3d8', 'devddd', datetime.datetime(2023, 4, 19, 11, 31, 22, 489515), datetime.dateti...
open-assistant-inference-server-1 | └ <asyncpg.prepared_stmt.PreparedStatement object at 0x7f1ff0ace2a0>
open-assistant-inference-server-1 |
open-assistant-inference-server-1 | File "/var/opt/inference/server/lib/asyncpg/prepared_stmt.py", line 241, in __bind_execute
open-assistant-inference-server-1 | data, status, _ = await self.__do_execute(
open-assistant-inference-server-1 | └ <asyncpg.prepared_stmt.PreparedStatement object at 0x7f1ff0ace2a0>
open-assistant-inference-server-1 |
open-assistant-inference-server-1 | File "/var/opt/inference/server/lib/asyncpg/prepared_stmt.py", line 230, in __do_execute
open-assistant-inference-server-1 | return await executor(protocol)
open-assistant-inference-server-1 | │ └ <asyncpg.protocol.protocol.Protocol object at 0x7f1ff40166c0>
open-assistant-inference-server-1 | └ <function PreparedStatement.__bind_execute.<locals>.<lambda> at 0x7f1ff0ad97e0>
open-assistant-inference-server-1 |
open-assistant-inference-server-1 | File "asyncpg/protocol/protocol.pyx", line 201, in bind_execute
open-assistant-inference-server-1 | return await waiter
open-assistant-inference-server-1 |
open-assistant-inference-server-1 | asyncpg.exceptions.ForeignKeyViolationError: insert or update on table "chat" violates foreign key constraint "chat_user_id_fkey"
open-assistant-inference-server-1 | DETAIL: Key (user_id)=(devddd) is not present in table "user".
because here user_id is actually username (devddd for example, instead of 8382e429-ad3e-41ea-9712-648ee569faa2)
https://github.com/LAION-AI/Open-Assistant/blob/4b79215b2f5f4e6e1eca9f375fbf3cfef1f7575b/inference/server/oasst_inference_server/user_chat_repository.py#L57
Please provide full steps on how to reproduce this. Our user management system is quite complicated atm, so this might be expected behavior
Hello, thank you for the reply. These are the steps I made that lead me to the error (i have retried multiple times and the error still presists)
DOCKER_BUILDKIT=1 docker compose --profile ci --profile inference up --build --attach-dependencies- Go to http://localhost:3000
- Authenticate with dev auth (or dev mail, same result)
- After authentication the page redirects you to http://localhost:3000/chat which says "Sorry, we encountered a server error. We're not sure what went wrong" (errorlog)
- Go to dashboard and agree with TOS. The previous error must be gone at this point
- Go to http://localhost:3000/chat and try to create a new chat. It actually creates new chat, but no response to messages is sent
The environment is a fresh system without any other docker containers
I get the same result when I try to access /chat page. Here is the error log from docker: TypeError: Cannot read properties of undefined (reading 'session') at MyApp (/app/.next/server/pages/_app.js:129:43) AxiosError: getaddrinfo ENOTFOUND inference-server
But I have used dev mail to login, and I can open the page with localhost:3000/dashboard. So I guess I have the valid session token. Or the inference server is not running properly?
@notmd
Is there a image which port is 8000 running?
@happy430 did you run docker-compose with additional --profile inference flag?
for debug users, the username is the user_id, for "real" accounts, we generate (or more precisely, next-auth) generates a uid.