Camunda 8 File Picker and File path

I’m using a form with the File Picker element, my goal is to upload an image that can then be processed by a HuggingFace connector using different AI model.

But I’ve come to realize that the variable for the file picker only store the pathing for the uploaded file, I’ve been trying to get the file content through a worker calling the Camunda 8 Rest Api using the file path
https://${REGION}.zeebe.camunda.io:443/${CLUSTER_ID}//v2/documents/:documentId

But I’m not sure if this even works since it’s in Alpha.

Otherwise I’ve been trying to use the AWS S3 Connector to send file to a bucket, but I’m having the same issues where as I don’t know how to pass the file content to the connector.

Maybe I need to use something different then the File Picker element in my form, because I’m really not sure how it is meant to be use if were unable to retrieve the content of the file.

Hi @Felix_Rouleau, welcome to the forums! One important note here is that the document handling features are still in an alpha release and not yet production ready. This means there may be bugs or incomplete features.

I believe the intention of the document handling feature is that the document reference is stored in a documents FEEL variable that you can use to reference the document. For instance, in the S3 connector, you can reference document (or document[1] if you allowed multiple uploads).

If you are using SaaS, I don’t think the alpha REST endpoints are fully enabled, so I wouldn’t expect the /v2/documents/:documentId endpoint to work at this time.

hey @Felix_Rouleau can you please share more details of the error you are getting, what happens when you call the API, what is the http status and the response you get?

This API should be working as part of 8.7.0-alpha3 and I would like to confirm if it’s the same API that you are using: Download document (alpha) | Camunda 8 Docs

Thanks!

1 Like

I’ve created a new cluster today in 3.7.0-alpha3, but I’m getting the same errors has in the 3.6 cluster

I’m getting a 404 not found http code.
The current step by step is I have a form with the file picker element, I’ve named the key “uploadedFile” . Then this form is linked to my bpmn, when I run it I upload a small image via the file picker.

I then setup a worker in Python to get this variable :

file_reference = job.variables.get(“uploadedFile”)

print(“File reference:”, file_reference)

Here is the result of the print
File reference: files::463f3bxlzkt2kvll9wfl0fa44

Then I’ve tried with either my worker or some Postman calls to fetch this image using the path
https://${REGION}.zeebe.camunda.io:443/${CLUSTER_ID}//v2/documents/{the file reference}

I’ve tried writing it every way, with “files::” without just the string of number and I always receive a 404 message.

My python error code

{“type”:“about:blank”,“title”:“io.camunda.document.api.DocumentError$DocumentNotFound”,“status”:404,“detail”:“Document with id ‘:files::463f3bxlzkt2kvll9wfl0fa44’ not found”,“instance”:“/{clusterID}/v2/documents/:files::463f3bxlzkt2kvll9wfl0fa44”}
Failed to fetch file content. Status code: 404

Although switching to the 3.7 Alpha cluster, my AWS S3 bucket connector gives me a new error message (previously it just didn’t complete and no error was thrown)

{“type”:“io.camunda.connector.api.error.ConnectorInputException”,“message”:“jakarta.validation.ValidationException: Found constraints violated while validating input: \n - Property: action.document: Validation failed.”}

If you need more details, i’ll be happy to provide. Thank you for answering

@Felix_Rouleau thanks for providing more details. I assume you are using SaaS clusters, if yes, can you provide me your clusterId so I can investigate it a bit.

Some initial thoughts, and sharing one example where I’m trying to reproduce your scenario:

1 - I created a process and using a file picker I’m uploading an image using Tasklist
2 - I’m checking Operate, and this is how the filepicker variable is being presented:

[
   {
      "camunda.document.type":"camunda",
      "storeId":"gcp",
      "documentId":"fccb1d74-ddd5-4746-a1b8-1ca5e8db6f50",
      "metadata":{
         "contentType":"application/pdf",
         "fileName":"Profile.pdf",
         "size":67331,
         "customProperties":{
            
         }
      }
   }
]

3 - Using the API, I’m trying to retrieve this document using the documentId returned:

curl --location '<cluster_endpoint>/v2/documents/fccb1d74-ddd5-4746-a1b8-1ca5e8db6f50' \

--header 'Authorization: ••••••' \

For me it worked properly, so I would like to confirm one thing as you mentioned to be using AWS Connector - Document Handling in SaaS is still not prepared to upload documents to AWS Buckets (it will be soon), it works for GCP by default at the moment, wondering if that would be the issue that you are facing as well.

Let me know if that helps somehow.

Update :
I now understand that you can start a process from the tasklist tab in the Camunda SaaS, I starting my process with the Run fucntion in the Modeler and for some reason the content of the file picker variable isn’t the same depending on where the instance was started.

But anyway I’ve managed to get the documentId and call the Camunda API via Postman and be able to view the image requested.

Thank a lot for the help with this.

Now a new issue arose, the huggingface connector to which i’m trying to pass the base64 encoding of the image retrieved by the API call (this is all done in a worker) the content is too big for the Camunda body, so my image is incomplete.

Is that a Camunda limitation?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.