Can't upload most files; Error 413 Request Entity Too Large #5042
-
What happened?I am able to successfully upload images under 1MB. However, I can't upload images over 1MB, and I can't upload any other files whether they be a JPG, PDF, or anything else. For files over 1MB, it fails with 413 Request Entity Too Large:
This is strange, because in my nginx configuration file (which runs on the host), I have set:
This should give me plenty of headroom. I have this set in my
Each user provides their own API key when they login. I can't find any respective error in With a .txt file that is 10 bytes large, it fails with error 500:
The respective server error for this is under "Relevant log output". It would seem to me that the issue is not the file size at all, but something else entirely. Steps to Reproduce
What browsers are you seeing the problem on?No response Relevant log outputrag_api-1 | USER_AGENT environment variable not set, consider setting it to identify your requests.
rag_api-1 | 2024-12-19 01:37:55,704 - root - INFO - Initialized embeddings of type: <class 'langchain_openai.embeddings.base.OpenAIEmbeddings'>
rag_api-1 | /app/store_factory.py:22: LangChainPendingDeprecationWarning: Please use JSONB instead of JSON for metadata. This change will allow for more efficient querying that involves filtering based on metadata. Please note that filtering operators have been changed when using JSONB metadata to be prefixed with a $ sign to avoid name collisions with columns. If you're using an existing database, you will need to create a db migration for your metadata column to be JSONB and update your queries to use the new operators.
rag_api-1 | return AsyncPgVector(
rag_api-1 | 2024-12-19 01:37:55,933 - uvicorn.error - INFO - Started server process [1]
rag_api-1 | 2024-12-19 01:37:55,939 - uvicorn.error - INFO - Waiting for application startup.
rag_api-1 | 2024-12-19 01:37:55,939 - uvicorn.error - INFO - Application startup complete.
rag_api-1 | 2024-12-19 01:37:55,940 - uvicorn.error - INFO - Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
rag_api-1 | 2024-12-19 01:51:06,442 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/embeddings "HTTP/1.1 401 Unauthorized"
rag_api-1 | 2024-12-19 01:51:06,449 - root - ERROR - Failed to store data in vector DB | File ID: 6b55332e-8a40-46dd-a5fa-1f4b73f4d137 | User ID: 6762afa06610c7ae8ecff8f6 | Error: Error code: 401 - {'error': {'message': 'Incorrect API key provided: user_pro*ided. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}} | Traceback: Traceback (most recent call last):
rag_api-1 | File "/app/main.py", line 326, in store_data_in_vector_db
rag_api-1 | ids = await vector_store.aadd_documents(
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/langchain_core/vectorstores/base.py", line 324, in aadd_documents
rag_api-1 | return await run_in_executor(None, self.add_documents, documents, **kwargs)
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/langchain_core/runnables/config.py", line 588, in run_in_executor
rag_api-1 | return await asyncio.get_running_loop().run_in_executor(
rag_api-1 | File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
rag_api-1 | result = self.fn(*self.args, **self.kwargs)
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/langchain_core/runnables/config.py", line 579, in wrapper
rag_api-1 | return func(*args, **kwargs)
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/langchain_core/vectorstores/base.py", line 287, in add_documents
rag_api-1 | return self.add_texts(texts, metadatas, **kwargs)
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/langchain_community/vectorstores/pgvector.py", line 561, in add_texts
rag_api-1 | embeddings = self.embedding_function.embed_documents(list(texts))
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/langchain_openai/embeddings/base.py", line 588, in embed_documents
rag_api-1 | return self._get_len_safe_embeddings(texts, engine=engine)
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/langchain_openai/embeddings/base.py", line 483, in _get_len_safe_embeddings
rag_api-1 | response = self.client.create(
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/openai/resources/embeddings.py", line 124, in create
rag_api-1 | return self._post(
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1280, in post
rag_api-1 | return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 957, in request
rag_api-1 | return self._request(
rag_api-1 | File "/usr/local/lib/python3.10/site-packages/openai/_base_client.py", line 1061, in _request
rag_api-1 | raise self._make_status_error_from_response(err.response) from None
rag_api-1 | openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: user_pro*ided. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
rag_api-1 |
rag_api-1 | 2024-12-19 01:51:06,451 - root - INFO - Request POST http://rag_api:8000/embed - 20 But the API key is correct. This can be verified by the fact that images under 1MB can be uploaded and OpenAI responds to them. ScreenshotsNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
From your logs:
Please read this for more information on configuring the RAG API, which is used for non-image files: |
Beta Was this translation helpful? Give feedback.
-
File upload works now. Don't use Nginx; use Traefik: https://www.librechat.ai/docs/remote/traefik |
Beta Was this translation helpful? Give feedback.
File upload works now. Don't use Nginx; use Traefik: https://www.librechat.ai/docs/remote/traefik