Skip to content

when ingest document with collection_ids error occurs #2028

@zhengwj533

Description

@zhengwj533

Describe the bug
when ingest document with collection_ids error occurs.

To Reproduce

ingest request like this, with collection_ids.

POST /v3/documents HTTP/1.1
Content-Length: 4372
Content-Type: multipart/form-data
Host: localhost:7272
User-Agent: HTTPie

--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="metadata"

{"catalog":"help"}
--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="file"; filename="10-dev-env.md"
Content-Type: 


--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="collection_ids"

["2cf8ceb6-1106-4c12-b233-7ef15cf74530","7a027464-a07c-4a04-9cbe-5976756791a8"]
--PieBoundary123456789012345678901234567
Content-Disposition: form-data; name="file-name"

10-dev-env.md
--PieBoundary123456789012345678901234567--

In the server side an error log like this:

ERROR - ingestion_workflow.py 178 : Error during assigning document to collection: invalid input for query argument $2: '2cf8ceb6-1106-4c12-b233-7ef15cf74530' (a sized iterable container expected (got type 'str'))

Additional context
Add any other context about the problem here.

in the source file documents_router.py:

documents_router.py:
            workflow_input = {
                "file_data": file_data,
                "document_id": str(document_id),
                "collection_ids": (
                    [str(cid) for cid in collection_ids]
                    if collection_ids
                    else None
                ),

and in the file documents.py:

        ids = [id] if isinstance(id, UUID) else id

maybe should be

        ids = id if isinstance(id, list) else [id]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions