Downloads API fails in multi node environment

cancel
Showing results for 
Search instead for 
Did you mean: 
uo67113
Active Member

Downloads API fails in multi node environment

Hello there,

We have alfresco repository [1] running in three diferent instances. From a front-end application (react) we want to donwload compressed in a zip multiple files. This works well but we are having an issue due alfresco repository deployed in multiple nodes. The sequence of requests looks like this:

  1. front-end sends a POST with the nodeId of the folder that contains the files we want to download to /alfresco/api/-default-/public/alfresco/versions/1/downloads Alfresco responds with the nodeId of the zip
  2. We start to make requests against /alfresco/api/-default-/public/alfresco/versions/1/downloads/nodeIdOfTheZip Alfresco responds with status PENDING until the zip file is ready, at that moment the status changes to DONE
  3. Finally we make a request against /alfresco/api/-default-/public/alfresco/versions/1/nodes/nodeIdOfTheZip/content and the zip is downloaded

The trouble is that from time to time, in the last request, we get a 404 error like this one:

{"error":{"errorKey":"framework.exception.ApiDefault","statusCode":404,"briefSummary":"06011072 Unable to locate content for node ref workspace://SpacesStore/nodeIdOfTheZip (property: {http://www.alfresco.org/model/content/1.0}content)","stackTrace":"For security reasons the stack trace is no longer displayed, but the property is kept for previous versions","descriptionURL":"https://api-explorer.alfresco.com"}}

We are thinking in a couple of possible workarounds:

  1. Stick the front-end requests to one node, our proxy setup uses a cookie for this purpose, but inject a cookie in react seems not so obvious Smiley Sad
  2. Set that cookie in the middleware (traefik)

None of the above convinced us 100% so we were wondering if there is something that could be done at alfresco repository level, so as always all ideas are welcome!!!

Thanks in advance,

Luis

[1] alfresco/alfresco-governance-repository-community:7.2.0