QuivrHQ / quivr

Opiniated RAG for integrating GenAI in your apps 🧠 Focus on your product rather than the RAG. Easy integration in existing products with customisation! Any LLM: GPT4, Groq, Llama. Any Vectorstore: PGVector, Faiss. Any Files. Anyway you want.
https://core.quivr.com
Other
36.6k stars 3.57k forks source link

[Bug]: Setting up locally shows screen "Talk to Quivr Unpaid users have access to a free and limited demo of Quivr" #2545

Closed opendeluxe closed 6 months ago

opendeluxe commented 6 months ago

What happened?

I setup the full stack locally on my macbook as described in the README. All docker containers are running well without any issues. However, when opening http://localhost:3000/login in a webbrowser, it only shows the logo and the text "Talk to Quivr Unpaid users have access to a free and limited demo of Quivr"

Screenshot 2024-05-05 at 23 03 12

According to the log, it seems to call some /user endpoints which respond with 403. I would expect that the login-form would be rendered instead first.

Relevant log output

beat          | [2024-05-05 21:05:00,000: INFO/MainProcess] Scheduler: Sending due task process_integration_brain_sync (celery_worker.process_integration_brain_sync)
worker        | [2024-05-05 21:05:00,012: INFO/MainProcess] Task celery_worker.process_integration_brain_sync[7da1bf77-3ee6-49cd-9c7f-05f9f2fd72f0] received
worker        | [2024-05-05 21:05:00,045: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/integrations_user?select=%2A%2C%20integrations%20%28%29&integrations.integration_name=eq.notion "HTTP/1.1 200 OK"
worker        | [2024-05-05 21:05:00,057: INFO/ForkPoolWorker-2] Task celery_worker.process_integration_brain_sync[7da1bf77-3ee6-49cd-9c7f-05f9f2fd72f0] succeeded in 0.040312542000037865s: Noneer Desktop   w Enable Watch
backend-core  | INFO:     127.0.0.1:37474 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:60676 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:42342 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:45582 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:45830 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:41716 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:59444 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:54708 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     192.168.65.1:53110 - "OPTIONS /user/credits HTTP/1.1" 200 OK
backend-core  | INFO:     192.168.65.1:53108 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     192.168.65.1:53109 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     192.168.65.1:53114 - "GET /user HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53112 - "GET /user/identity HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53113 - "GET /user/credits HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53112 - "GET /user/identity HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53113 - "GET /user HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53112 - "GET /user HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53113 - "GET /user/identity HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53112 - "GET /user/identity HTTP/1.1" 403 Forbidden
backend-core  | INFO:     192.168.65.1:53113 - "GET /user HTTP/1.1" 403 Forbidden
backend-core  | INFO:     127.0.0.1:56056 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:57530 - "GET /healthz HTTP/1.1" 200 OK
beat          | [2024-05-05 21:10:00,037: INFO/MainProcess] Scheduler: Sending due task process_integration_brain_sync (celery_worker.process_integration_brain_sync)
worker        | [2024-05-05 21:10:00,048: INFO/MainProcess] Task celery_worker.process_integration_brain_sync[df4ede5e-3ab4-4149-8850-5ab979e52130] received
worker        | [2024-05-05 21:10:00,071: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/integrations_user?select=%2A%2C%20integrations%20%28%29&integrations.integration_name=eq.notion "HTTP/1.1 200 OK"
worker        | [2024-05-05 21:10:00,073: INFO/ForkPoolWorker-2] Task celery_worker.process_integration_brain_sync[df4ede5e-3ab4-4149-8850-5ab979e52130] succeeded in 0.02032537499985665s: Noneker Desktop   w Enable Watch
backend-core  | INFO:     127.0.0.1:38962 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:43536 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:51506 - "GET /healthz HTTP/1.1" 200 OK

Twitter / LinkedIn details

No response

dosubot[bot] commented 6 months ago

It looks like the issue you're encountering with the 403 Forbidden responses is related to server-side authentication or configuration problems. Here's a more focused approach to troubleshoot and potentially resolve the issue:

  1. Server-Side Authentication Logic: Verify that your backend correctly handles authentication for local requests. This includes checking CORS settings and other security configurations that might block local requests.

  2. API Endpoint Accessibility: Ensure that any external APIs or backend services your login functionality depends on are accessible from your local setup. This might involve checking API keys or domain restrictions.

  3. Local Environment Configuration: Double-check your local environment configuration, including environment variables and any necessary settings to ensure they match what's required for successful communication with backend services.

  4. Debug Network Requests: Use browser developer tools to inspect the failed network requests. Pay close attention to request headers and payloads to identify potential misconfigurations.

  5. Frontend Configuration: Review your frontend code for any environment-specific settings that might affect the login process. Ensure that API endpoints and authentication configurations are correctly set for local development.

  6. Backend or API Documentation: If using third-party APIs or backend services, consult their documentation for guidance on setting up for local development, including any development-specific keys or settings.

  7. Middleware or Proxy Configuration: If your setup involves middleware or proxies, ensure they are correctly configured to allow requests to pass through to your application without being blocked.

For a more targeted investigation, review the server-side logic for endpoints returning 403 responses, ensure your .env file matches the required configurations as outlined in .env.example, and check for any potential misconfigurations in middleware or proxies that could lead to these responses.

If these steps do not resolve the issue, providing more details about your setup and any additional error messages could help in offering further assistance.

#### Details **Sources** - [Localhost:3000 doesn't load the app](https://github.com/QuivrHQ/quivr/issues/281) - [frontend/app/(auth)/login/page.tsx](https://github.com/QuivrHQ/quivr/blob/main/frontend/app/(auth)/login/page.tsx) - [backend/modules/user/controller/user_controller.py](https://github.com/QuivrHQ/quivr/blob/main/backend/modules/user/controller/user_controller.py) - [docs/configuring/environment-variables.mdx](https://github.com/QuivrHQ/quivr/blob/main/docs/configuring/environment-variables.mdx) - [.env.example](https://github.com/QuivrHQ/quivr/blob/main/.env.example) - [cms/quivr/config/middlewares.js](https://github.com/QuivrHQ/quivr/blob/main/cms/quivr/config/middlewares.js) - [frontend/next.config.js](https://github.com/QuivrHQ/quivr/blob/main/frontend/next.config.js) - [backend/middlewares/auth/auth_bearer.py](https://github.com/QuivrHQ/quivr/blob/main/backend/middlewares/auth/auth_bearer.py) - [frontend/lib/api/user/user.ts](https://github.com/QuivrHQ/quivr/blob/main/frontend/lib/api/user/user.ts) - [frontend/lib/api/user/useUserApi.ts](https://github.com/QuivrHQ/quivr/blob/main/frontend/lib/api/user/useUserApi.ts) - [docs/install.mdx](https://github.com/QuivrHQ/quivr/blob/main/docs/install.mdx) - [README.md](https://github.com/QuivrHQ/quivr/blob/main/README.md)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

powderblock commented 6 months ago

Having the same issue after pulling the newest version of main branch. It was working previously with a version from ~2 weeks ago.

sgwaterwoods commented 6 months ago

I have exactly same issue

dazeb commented 6 months ago

Same issue here. Came back to test after it not working last time and now this 😂

add /user] to the end of the URL makes the site attempt loading but goes wild lol

opendeluxe commented 6 months ago

I think the README needs some further adjustments after recent changes

4ku commented 6 months ago

What is the last workable version?

BestLemoon commented 6 months ago

Having the same issue after pulling the newest version of main branch. It was working previously with a version from ~2 weeks ago.

Hi, what is the last workable version, thank you.

sgwaterwoods commented 6 months ago

I saw some update made a few hours ago and execute git pull and supabase migration up and get the following error.

Connecting to local database... runtime error: slice bounds out of range [1:0] Try rerunning the command with --debug to troubleshoot the error.

The issue is still there.

4ku commented 6 months ago

@StanGirard any ideas?

StanGirard commented 6 months ago

Add NEXT_PUBLIC_AUTH_MODES=password to your env file :D

4ku commented 6 months ago

@StanGirard It doesn't help, unfortunately (

sweatybridge commented 6 months ago
Connecting to local database...
runtime error: slice bounds out of range [1:0]
Try rerunning the command with --debug to troubleshoot the error.

This could be a supabase issue that we fixed recently. You can try npx supabase@beta migration up instead.

StanGirard commented 6 months ago

Sorry about that, forgot to add the variable to the docker compose too.

Please git pull and docker compose up --build

StanGirard commented 6 months ago

@sweatybridge you could try a supabase db reset too :)

4ku commented 6 months ago

@StanGirard Now it works! But I have another error while creating first brain:

backend-core  | USER_IDENTITY {'user_id': '39418e3b-0258-4452-af60-7acfcc1263ff', 'openai_api_key': None, 'company': '', 'onboarded': True, 'username': 'www', 'company_size': None, 'usage_purpose': ''}
backend-core  | INFO:     172.21.0.1:33786 - "PUT /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.21.0.1:33786 - "OPTIONS /brains/ HTTP/1.1" 200 OK
backend-core  | INFO:     172.21.0.1:33786 - "POST /brains/ HTTP/1.1" 500 Internal Server Error
backend-core  | ERROR:    Exception in ASGI application
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 411, in run_asgi
backend-core  |     result = await app(  # type: ignore[func-returns-value]
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
backend-core  |     return await self.app(scope, receive, send)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
backend-core  |     await super().__call__(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
backend-core  |     await self.middleware_stack(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
backend-core  |     raise exc
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
backend-core  |     await self.app(scope, receive, _send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in __call__
backend-core  |     await self.simple_response(scope, receive, send, request_headers=headers)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response
backend-core  |     await self.app(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
backend-core  |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
backend-core  |     raise exc
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
backend-core  |     await app(scope, receive, sender)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
backend-core  |     await self.middleware_stack(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
backend-core  |     await route.handle(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
backend-core  |     await self.app(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
backend-core  |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
backend-core  |     raise exc
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
backend-core  |     await app(scope, receive, sender)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
backend-core  |     response = await func(request)
backend-core  |                ^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
backend-core  |     raw_response = await run_endpoint_function(
backend-core  |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
backend-core  |     return await dependant.call(**values)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/code/modules/brain/controller/brain_routes.py", line 103, in create_new_brain
backend-core  |     new_brain = brain_service.create_brain(
backend-core  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/code/modules/brain/service/brain_service.py", line 142, in create_brain
backend-core  |     return self.create_brain_integration(user_id, brain)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/code/modules/brain/service/brain_service.py", line 192, in create_brain_integration
backend-core  |     created_brain = self.brain_repository.create_brain(brain)
backend-core  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/code/modules/brain/repository/brains.py", line 24, in create_brain
backend-core  |     brain_meaning = embeddings.embed_query(string_to_embed)
backend-core  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 530, in embed_query
backend-core  |     return self.embed_documents([text])[0]
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 489, in embed_documents
backend-core  |     return self._get_len_safe_embeddings(texts, engine=engine)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/langchain_openai/embeddings/base.py", line 347, in _get_len_safe_embeddings
backend-core  |     response = self.client.create(
backend-core  |                ^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/openai/resources/embeddings.py", line 114, in create
backend-core  |     return self._post(
backend-core  |            ^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 1240, in post
backend-core  |     return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
backend-core  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 921, in request
backend-core  |     return self._request(
backend-core  |            ^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 1020, in _request
backend-core  |     raise self._make_status_error_from_response(err.response) from None
backend-core  | openai.PermissionDeniedError: Error code: 403 - {'error': {'code': 'unsupported_country_region_territory', 'message': 'Country, region, or territory not supported', 'param': None, 'type': 'request_forbidden'}}
backend-core  | INFO:     127.0.0.1:53244 - "GET /healthz HTTP/1.1" 200 OK
4ku commented 6 months ago

Fixed previous error wth VPN, thanks