langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
43.06k stars 5.97k forks source link

forbidden: user 'anonymous' has insufficient permissions to list schema/* #6262

Closed boxter007 closed 3 weeks ago

boxter007 commented 1 month ago

Self Checks

Dify version

0.6.13

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

1、Start middleware using docker-compose.middleware.yaml 2、Knowledge-->create knowledge-->choose one file -->index mode (High Quality),vector index(jina-embeddings-v2-base-zh| rerank:jina-reranker-v2-base-multilingual)-->save and process-->ERROR:

[2024-07-14 03:31:33,929: ERROR/MainProcess] consume document failed
Traceback (most recent call last):
  File "/home/haojing/code/dify/api/core/indexing_runner.py", line 76, in run
    self._load(
  File "/home/haojing/code/dify/api/core/indexing_runner.py", line 689, in _load
    tokens += future.result()
              ^^^^^^^^^^^^^^^
  File "/anaconda3/lib/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/anaconda3/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/anaconda3/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haojing/code/dify/api/core/indexing_runner.py", line 742, in _process_chunk
    index_processor.load(dataset, chunk_documents, with_keywords=False)
  File "/home/haojing/code/dify/api/core/rag/index_processor/processor/paragraph_index_processor.py", line 60, in load
    vector.create(documents)
  File "/home/haojing/code/dify/api/core/rag/datasource/vdb/vector_factory.py", line 99, in create
    self._vector_processor.create(
  File "/home/haojing/code/dify/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py", line 89, in create
    self._create_collection()
  File "/home/haojing/code/dify/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py", line 100, in _create_collection
    if not self._client.schema.contains(schema):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/haojing/code/dify/api/.venv/lib/python3.11/site-packages/weaviate/schema/crud_schema.py", line 320, in contains
    loaded_schema = self.get()
                    ^^^^^^^^^^
  File "/home/haojing/code/dify/api/.venv/lib/python3.11/site-packages/weaviate/schema/crud_schema.py", line 506, in get
    raise UnexpectedStatusCodeException("Get schema", response)
weaviate.exceptions.UnexpectedStatusCodeException: Get schema! Unexpected status code: 403, with response body: {'error': [{'message': "forbidden: user 'anonymous' has insufficient permissions to list schema/*"}]}.

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 1 month ago

Hey @boxter007! I'm here to help you with any bugs, questions, or contributions you might have. Let's tackle this together!

To resolve the permission issue where the user 'anonymous' has insufficient permissions to list schema/* when processing a file using the high-quality index mode and vector index in Dify version 0.6.13, you need to ensure that the API requests include the appropriate API-Key in the Authorization HTTP Header.

Here is an example of how to include the API-Key in your request:

curl --location --request POST 'https://your-dify-instance/api/datasets/{dataset_id}/document/create_by_file' \
--header 'Authorization: Bearer {API_KEY}' \
--form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
--form 'file=@"/path/to/file"'

Make sure to replace {API_KEY} with your actual API key and https://your-dify-instance with the base URL of your Dify instance. This should resolve the permission issue by authenticating the request properly [1].

To continue talking to Dosu, mention @dosu.

boxter007 commented 1 month ago

do not make sence

crazywoola commented 1 month ago

I think it's related to this thread