Repository navigation
dify1.18.1, calling the https://api.dify.ai/v1/datasets/{dataset_id}/document/create-by-file API throws an error. #45755
Replies: 2 comments
|
This strongly matches the file-document API regression fixed in #44972, rather than a missing The affected file path passed the dataset creator into document creation without initializing that account’s tenant context. The fix initializes it and falls back to the authenticated workspace owner if the creator has left the workspace. The text path uses the authenticated As of November 7, the fix is included in the 1.19.0 release. For your self-hosted deployment, use its official upgrade guide, including backups, matching component versions and the normal migration process. Do not manually add or populate tenant fields to address this assertion. [5] One detail to clarify: is To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
|
The error message itself would help narrow this down, but the most common failure on this endpoint is the request shape. It has to be multipart/form-data with two fields: Working form: curl -X POST 'https://api.dify.ai/v1/datasets/<dataset_id>/document/create-by-file' \
-H 'Authorization: Bearer <dataset-api-key>' \
-F 'file=@/path/to/doc.pdf' \
-F 'data={"indexing_technique":"high_quality","process_rule":{"mode":"automatic"}}'Also check you're using a dataset API key, not an app key. They're issued separately in the dataset's API access settings, and an app key returns an auth error there. — |
Uh oh!
There was an error while loading. Please reload this page.
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
After upgrading Dify from 1.13.3 to 1.18.1, calling the https://api.dify.ai/v1/datasets/{dataset_id}/document/create-by-file API throws an error. The log outputs:
"api-1 | File "/app/api/services/knowledge/dataset_service.py", line 2165, in save_document_with_dataset_id
api-1 | assert account.current_tenant_id is not None"
My settings already have the knowledge base API key.
Is it because the 1.13.3 version of the database doesn't have the tenant_id field, so the data is missing? That's why it can't adapt to the new version? But the "/datasets/{dataset_id}/document/create-by-text" API can still use the 1.13.3 interface parameters.
2. Additional context or comments
No response
All reactions