defenseunicorns / leapfrogai

Production-ready Generative AI for local, cloud native, airgap, and edge deployments.
https://leapfrog.ai
Apache License 2.0
250 stars 28 forks source link

bug: Supabase client connection attempts failed #954

Open gscallon opened 2 weeks ago

gscallon commented 2 weeks ago

Environment

  1. OS and Architecture: RKE2 (airgapped)
  2. App or Package Name: LeapfrogAI
  3. App or Package Version: v0.11.0
  4. Kubernetes Distribution: RKE2
  5. Kubernetes Version: v1.28.2
  6. Other:

Steps to reproduce

  1. Set up 10+ users with LFAI
  2. Add multiple assistants and a large number of files to the file management system (varied number of assistants and files per user).
  3. Have the users logged in at the same time and have the users perform various operations.

Expected result

Actual Result

Visual Proof (screenshots, videos, text, etc)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/leapfrogai/.venv/lib/python3.11/site-packages/gotrue/_async/gotrue_base_api.py", line 111, in _request response = await self._http_client.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1574, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1661, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1689, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1763, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 372, in handle_async_request with map_httpcore_exceptions(): File "/usr/lib/python3.11/contextlib.py", line 155, in exit self.gen.throw(typ, value, traceback) File "/leapfrogai/.venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: All connection attempts failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/leapfrogai/.venv/lib/python3.11/site-packages/leapfrogai_api/routers/supabase_session.py", line 60, in init_supabase_client await client.auth.set_session( File "/leapfrogai/.venv/lib/python3.11/site-packages/gotrue/_async/gotrue_client.py", line 640, in set_session response = await self.get_user(access_token) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/gotrue/_async/gotrue_client.py", line 586, in get_user return await self._request("GET", "user", jwt=jwt, xform=parse_user_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/leapfrogai/.venv/lib/python3.11/site-packages/gotrue/_async/gotrue_base_api.py", line 123, in _request raise handle_exception(e) gotrue.errors.AuthRetryableError: All connection attempts failed


- Error message found in leapfrogai-ui logs:

Listening on 0.0.0.0:3000 InternalServerError: 500 status code (no body) at APIError.generate (file:///app/node_modules/openai/error.mjs:62:20) at OpenAI.makeStatusError (file:///app/node_modules/openai/core.mjs:268:25) at OpenAI.makeRequest (file:///app/node_modules/openai/core.mjs:311:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GET (file:///app/build/server/chunks/_server.ts-Bh-eBlsA.js:11:16) at async render_endpoint (file:///app/build/server/index.js:1228:20) at async resolve2 (file:///app/build/server/index.js:3708:22) at async csp (file:///app/build/server/chunks/hooks.server-BtaMPuC-.js:92:20) at async respond (file:///app/build/server/index.js:3603:22) at async Array.ssr (file:///app/build/handler.js:1261:3) { status: 500, headers: { 'content-length': '46', 'content-type': 'application/json', date: 'Tue, 27 Aug 2024 19:32:31 GMT', server: 'envoy', 'x-envoy-upstream-service-time': '33' }, request_id: undefined, error: undefined, code: undefined, param: undefined, type: undefined } Error fetching assistants InternalServerError: 500 status code (no body) at APIError.generate (file:///app/node_modules/openai/error.mjs:62:20) at OpenAI.makeStatusError (file:///app/node_modules/openai/core.mjs:268:25) at OpenAI.makeRequest (file:///app/node_modules/openai/core.mjs:311:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GET (file:///app/build/server/chunks/_server.ts-DJXll3aH.js:12:28) at async render_endpoint (file:///app/build/server/index.js:1228:20) at async resolve2 (file:///app/build/server/index.js:3708:22) at async csp (file:///app/build/server/chunks/hooks.server-BtaMPuC-.js:92:20) at async respond (file:///app/build/server/index.js:3603:22) at async Array.ssr (file:///app/build/handler.js:1261:3) { status: 500, headers: { 'content-length': '46', 'content-type': 'application/json', date: 'Tue, 27 Aug 2024 19:32:31 GMT', server: 'envoy', 'x-envoy-upstream-service-time': '31' }, request_id: undefined, error: undefined, code: undefined, param: undefined, type: undefined } (node:1) ExperimentalWarning: buffer.File is an experimental feature and might change at any time (Use node --trace-warnings ... to show where the warning was created) Error fetching thread or messages: Error: 500 status code (no body) Error fetching assistants InternalServerError: 500 status code (no body) at APIError.generate (file:///app/node_modules/openai/error.mjs:62:20) at OpenAI.makeStatusError (file:///app/node_modules/openai/core.mjs:268:25) at OpenAI.makeRequest (file:///app/node_modules/openai/core.mjs:311:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GET (file:///app/build/server/chunks/_server.ts-DJXll3aH.js:12:28) at async render_endpoint (file:///app/build/server/index.js:1228:20) at async resolve2 (file:///app/build/server/index.js:3708:22) at async csp (file:///app/build/server/chunks/hooks.server-BtaMPuC-.js:92:20) at async respond (file:///app/build/server/index.js:3603:22) at async fetch (file:///app/build/server/index.js:3360:26) { status: 500, headers: { 'content-length': '46', 'content-type': 'application/json', date: 'Tue, 27 Aug 2024 19:32:45 GMT', server: 'envoy', 'x-envoy-upstream-service-time': '42' }, request_id: undefined, error: undefined, code: undefined, param: undefined, type: undefined } Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) InternalServerError: 500 status code (no body) at APIError.generate (file:///app/node_modules/openai/error.mjs:62:20) at OpenAI.makeStatusError (file:///app/node_modules/openai/core.mjs:268:25) at OpenAI.makeRequest (file:///app/node_modules/openai/core.mjs:311:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GET (file:///app/build/server/chunks/_server.ts-Bh-eBlsA.js:11:16) at async render_endpoint (file:///app/build/server/index.js:1228:20) at async resolve2 (file:///app/build/server/index.js:3708:22) at async csp (file:///app/build/server/chunks/hooks.server-BtaMPuC-.js:92:20) at async respond (file:///app/build/server/index.js:3603:22) at async fetch (file:///app/build/server/index.js:3360:26) { status: 500, headers: { 'content-length': '46', 'content-type': 'application/json', date: 'Tue, 27 Aug 2024 19:32:45 GMT', server: 'envoy', 'x-envoy-upstream-service-time': '43' }, request_id: undefined, error: undefined, code: undefined, param: undefined, type: undefined } Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) Error fetching thread or messages: Error: 500 status code (no body) InternalServerError: 500 status code (no body) at APIError.generate (file:///app/node_modules/openai/error.mjs:62:20) at OpenAI.makeStatusError (file:///app/node_modules/openai/core.mjs:268:25) at OpenAI.makeRequest (file:///app/node_modules/openai/core.mjs:311:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GET (file:///app/build/server/chunks/_server.ts-Bh-eBlsA.js:11:16) at async render_endpoint (file:///app/build/server/index.js:1228:20) at async resolve2 (file:///app/build/server/index.js:3708:22) at async csp (file:///app/build/server/chunks/hooks.server-BtaMPuC-.js:92:20) at async respond (file:///app/build/server/index.js:3603:22) at async fetch (file:///app/build/server/index.js:3360:26) { status: 500, headers: { 'content-length': '46', 'content-type': 'application/json', date: 'Tue, 27 Aug 2024 19:32:46 GMT', server: 'envoy', 'x-envoy-upstream-service-time': '18' }, request_id: undefined, error: undefined, code: undefined, param: undefined, type: undefined } Error fetching assistants InternalServerError: 500 status code (no body) at APIError.generate (file:///app/node_modules/openai/error.mjs:62:20) at OpenAI.makeStatusError (file:///app/node_modules/openai/core.mjs:268:25) at OpenAI.makeRequest (file:///app/node_modules/openai/core.mjs:311:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async GET (file:///app/build/server/chunks/_server.ts-DJXll3aH.js:12:28) at async render_endpoint (file:///app/build/server/index.js:1228:20) at async resolve2 (file:///app/build/server/index.js:3708:22) at async csp (file:///app/build/server/chunks/hooks.server-BtaMPuC-.js:92:20) at async respond (file:///app/build/server/index.js:3603:22) at async fetch (file:///app/build/server/index.js:3360:26) { status: 500, headers: { 'content-length': '46', 'content-type': 'application/json', date: 'Tue, 27 Aug 2024 19:32:46 GMT', server: 'envoy', 'x-envoy-upstream-service-time': '18' }, request_id: undefined, error: undefined, code: undefined, param: undefined, type: undefined }



### Additional Context

Add any other context or screenshots about the technical debt here.
justinthelaw commented 2 weeks ago

Were there any Supabase auth pod logs recorded? We might need to run the locust tests on an RKE2 deployment locally, but it is a bit hard to mimic the same network topology experienced in the target environment that you may have encountered this issue in. However, it might just purely be an API issue based on the logs provided.

For the time being, this will likely be prioritized in the next milestone, (M11) - Conformance | Stability | Documentation.

gscallon commented 2 weeks ago

I can see if the the separate auth logs were captured in our notes, otherwise we can see if we can get into the server and retrieve them