quivr icon indicating copy to clipboard operation
quivr copied to clipboard

[Issue] Creating Brain results in CORS Error

Open regenrek opened this issue 1 year ago • 12 comments

Hi,

fresh install with Apple M1

image

Any Ideas?

Logs:

backend  | INFO:     Will watch for changes in these directories: ['/code']
backend  | INFO:     Uvicorn running on http://0.0.0.0:5050 (Press CTRL+C to quit)
backend  | INFO:     Started reloader process [7] using StatReload
web      | - info Loaded env from /app/.env
backend  | INFO:     Started server process [9]
backend  | INFO:     Waiting for application startup.
backend  | [INFO] Using already downloaded file pandoc-3.1.5-1-arm64.deb
backend  | 2023-07-10 08:34:58,652:INFO - Using already downloaded file pandoc-3.1.5-1-arm64.deb
backend  | [INFO] Unpacking pandoc-3.1.5-1-arm64.deb to tempfolder...
backend  | 2023-07-10 08:34:58,653:INFO - Unpacking pandoc-3.1.5-1-arm64.deb to tempfolder...
backend  | [INFO] Copying pandoc to /root/bin ...
backend  | 2023-07-10 08:35:00,832:INFO - Copying pandoc to /root/bin ...
backend  | [INFO] Making /root/bin/pandoc executeable...
backend  | 2023-07-10 08:35:00,903:INFO - Making /root/bin/pandoc executeable...
backend  | [INFO] Copying copyright to /root/bin ...
backend  | 2023-07-10 08:35:00,903:INFO - Copying copyright to /root/bin ...
backend  | INFO:     Application startup complete.
backend  | INFO:     172.19.0.1:61434 - "GET /brains/ HTTP/1.1" 500 Internal Server Error
backend  | ERROR:    Exception in ASGI application
backend  | Traceback (most recent call last):
backend  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
backend  |     result = await app(  # type: ignore[func-returns-value]
backend  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
backend  |     return await self.app(scope, receive, send)
backend  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 276, in __call__
backend  |     await super().__call__(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
backend  |     await self.middleware_stack(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
backend  |     raise exc
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
backend  |     await self.app(scope, receive, _send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in __call__
backend  |     await self.simple_response(scope, receive, send, request_headers=headers)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
backend  |     await self.app(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
backend  |     raise exc
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
backend  |     await self.app(scope, receive, sender)
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
backend  |     raise e
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
backend  |     await self.app(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
backend  |     await route.handle(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
backend  |     await self.app(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
backend  |     response = await func(request)
backend  |                ^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app
backend  |     raw_response = await run_endpoint_function(
backend  |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
backend  |     return await dependant.call(**values)
backend  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/code/routes/brain_routes.py", line 40, in brain_endpoint
backend  |     brains = brain.get_user_brains(current_user.id)
backend  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/code/models/brains.py", line 55, in get_user_brains
backend  |     .execute()
backend  |      ^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/postgrest/_sync/request_builder.py", line 68, in execute
backend  |     raise APIError(r.json())
backend  | postgrest.exceptions.APIError: {'code': 'PGRST200', 'details': "Searched for a foreign key relationship between 'brains_users' and 'brains' in the schema 'public', but no matches were found.", 'hint': None, 'message': "Could not find a relationship between 'brains_users' and 'brains' in the schema cache"}
backend  | INFO:     172.19.0.1:61436 - "GET /brains/default/ HTTP/1.1" 500 Internal Server Error
backend  | ERROR:    Exception in ASGI application
backend  | Traceback (most recent call last):
backend  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
backend  |     result = await app(  # type: ignore[func-returns-value]
backend  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
backend  |     return await self.app(scope, receive, send)
backend  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 276, in __call__
backend  |     await super().__call__(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
backend  |     await self.middleware_stack(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
backend  |     raise exc
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
backend  |     await self.app(scope, receive, _send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in __call__
backend  |     await self.simple_response(scope, receive, send, request_headers=headers)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
backend  |     await self.app(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
backend  |     raise exc
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
backend  |     await self.app(scope, receive, sender)
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
backend  |     raise e
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
backend  |     await self.app(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
backend  |     await route.handle(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
backend  |     await self.app(scope, receive, send)
backend  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
backend  |     response = await func(request)
backend  |                ^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app
backend  |     raw_response = await run_endpoint_function(
backend  |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
backend  |     return await dependant.call(**values)
backend  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/code/routes/brain_routes.py", line 58, in get_default_brain_endpoint
backend  |     default_brain = get_default_user_brain(current_user)
backend  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend  |   File "/code/models/brains.py", line 248, in get_default_user_brain
backend  |     .execute()
backend  |      ^^^^^^^^^
backend  |   File "/usr/local/lib/python3.11/site-packages/postgrest/_sync/request_builder.py", line 68, in execute
backend  |     raise APIError(r.json())
backend  | postgrest.exceptions.APIError: {'code': '42P01', 'details': None, 'hint': None, 'message': 'relation "public.brains_users" does not exist'}

Regards

regenrek avatar Jul 10 '23 08:07 regenrek

Same error with Intel Chip. Screenshot 2023-07-10 at 11 40 07

grebett avatar Jul 10 '23 09:07 grebett

Duplicate of https://github.com/StanGirard/quivr/issues/559#issue-1794860745?

grebett avatar Jul 10 '23 10:07 grebett

It means the backend doesn't work. You probably forgot to run the migrations ;)

StanGirard avatar Jul 10 '23 12:07 StanGirard

image

I get stuck running the migration.sh script at the point in the attached screen shot. It will not allow me to select any option.

I tried to run the migration manually (by simply copying the https://github.com/StanGirard/quivr/blob/main/scripts/tables.sql script into a "New Query" in Supa and it executed without issue. However, I still have the same problem as listed here by other with creating a 'brain' and with chatting.

image

image

ziptron avatar Jul 10 '23 16:07 ziptron

any progress here? https://www.youtube.com/watch?v=rFEbz93G9U8 soon i will test manually, not using helper script if any put a PR for solve this pls share....

johnfelipe avatar Jul 10 '23 17:07 johnfelipe

I tried manually, still did not work.

ziptron avatar Jul 10 '23 17:07 ziptron

@ziptron do u use steps like in video?

johnfelipe avatar Jul 10 '23 17:07 johnfelipe

Yes, tried it twice.

ziptron avatar Jul 10 '23 17:07 ziptron

Ok, then i will wait pls hurry up for solve this issue is an issue for installation, then will be ensure a good effort for solve it

El lun, 10 jul 2023 a las 12:30, ziptron @.***>) escribió:

Yes, tried it twice.

— Reply to this email directly, view it on GitHub https://github.com/StanGirard/quivr/issues/581#issuecomment-1629406526, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADIWFDRT7YUXURPZFYS3UTXPQ32HANCNFSM6AAAAAA2EGHE2M . You are receiving this because you commented.Message ID: @.***>

johnfelipe avatar Jul 10 '23 17:07 johnfelipe

So I solved this issue for myself.

I had two problems.

The biggest issue was that the backend was not running. I fixed this using (https://github.com/StanGirard/quivr/issues/556) The next issue was Firefox. I still have issue running this in firefox, but I got it to run it Edge browser.

ziptron avatar Jul 11 '23 13:07 ziptron

The issue for me was accessing via 0.0.0.0:3000 instead of localhost:3000

ollieanwyll avatar Jul 12 '23 18:07 ollieanwyll

The issue for me was accessing via 0.0.0.0:3000 instead of localhost:3000

in chrome is possible do that?

johnfelipe avatar Jul 12 '23 19:07 johnfelipe

Thanks for your contributions, we'll be closing this issue as it has gone stale. Feel free to reopen if you'd like to continue the discussion.

github-actions[bot] avatar Aug 20 '23 12:08 github-actions[bot]