Open shengxiagit opened 4 days ago
I found a similar closed issue regarding a "File not found" error when uploading a file in a self-hosted Dify setup using Docker. The suggested solution involves ensuring that the local storage path is correctly configured and mounted. Here are the steps you can follow:
Set the STORAGE_TYPE
to local
:
export STORAGE_TYPE=local
Define the STORAGE_LOCAL_PATH
:
export STORAGE_LOCAL_PATH=/path/to/local/storage
Mount the storage directory in your Docker setup:
Ensure that the /app/api/storage
directory in both containers is mounted to the same local directory. This can be done by adding the following volume configuration in your docker-compose.yml
file:
volumes:
- /path/to/local/storage:/app/api/storage
Restart your Docker containers:
docker-compose down
docker-compose up -d
Additionally, ensure that the storage directory has the appropriate permissions and ownership settings to allow the Docker container to read from and write to it. Another user mentioned that attaching a NAS as a PVC solved the problem, indicating that shared storage between containers is necessary [1].
To continue talking to Dosu, mention @dosu.
I found a similar closed issue regarding a "File not found" error when uploading a file in a self-hosted Dify setup using Docker. The suggested solution involves ensuring that the local storage path is correctly configured and mounted. Here are the steps you can follow:
- Set the
STORAGE_TYPE
tolocal
:export STORAGE_TYPE=local
- Define the
STORAGE_LOCAL_PATH
:export STORAGE_LOCAL_PATH=/path/to/local/storage
- Mount the storage directory in your Docker setup: Ensure that the
/app/api/storage
directory in both containers is mounted to the same local directory. This can be done by adding the following volume configuration in yourdocker-compose.yml
file:volumes: - /path/to/local/storage:/app/api/storage
- Restart your Docker containers:
docker-compose down docker-compose up -d
Additionally, ensure that the storage directory has the appropriate permissions and ownership settings to allow the Docker container to read from and write to it. Another user mentioned that attaching a NAS as a PVC solved the problem, indicating that shared storage between containers is necessary [1].
To continue talking to Dosu, mention @dosu.
But I am using aliyun-oss, not local. And the file has been successfully uploaded to aliyun-oss @dosu
Link https://github.com/langgenius/dify/issues/10069
This one can call it but it doesn't get the file.
If you're using Aliyun OSS and encountering a "File not found" error despite successful uploads, consider these potential causes and solutions:
Check the api/storage/privkeys
File: Ensure that the api/storage/privkeys
file is not deleted or missing. This file is crucial for encrypting large model keys, and its absence can lead to errors. If it's lost, you can reset the encryption keys using:
docker exec -it docker-api-1 flask reset-encrypt-key-pair
This command is for Docker Compose deployment. For source code startup, run it from the API directory.
Verify Configuration Settings: Double-check your Aliyun OSS configuration settings in your environment variables. Ensure that all required parameters like ALIYUN_OSS_BUCKET_NAME
, ALIYUN_OSS_ACCESS_KEY
, ALIYUN_OSS_SECRET_KEY
, ALIYUN_OSS_ENDPOINT
, and ALIYUN_OSS_REGION
are correctly set.
Check for Consistency: Ensure that the file paths and names used in your application match those in Aliyun OSS. Any discrepancies can cause the application to not find the file even if it exists in the storage.
Retry Mechanism: Since you mentioned that retrying works, there might be a timing issue or a temporary connectivity problem. Implementing a retry mechanism in your application logic might help mitigate this issue.
These steps should help address the "File not found" error when using Aliyun OSS with Dify [1][2].
To continue talking to Dosu, mention @dosu.
Self Checks
Dify version
0.9.2 - 0.10.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I did not capture any error logs in docker. I use aliyun-oss as file storage.
✔️ Expected Behavior
process document success
❌ Actual Behavior
I use aliyun-oss as file storage. When I upload a document via the API, I will get the following error message: File not found. But When I click the retry button it works fine.