"Download failed" error

Do you want to: Suggest a feature / Report a bug / Ask a how-to question
Ask a how-to question

Document Server version: Latest

Type of installation of the Document Server (docker, deb/rpm, exe, please point us to the installation guide that you used as well):
Docker

OS:
Arch Linux

Browser version:
Firefox 134

Issue:

Relevant logs:

[2025-01-21T18:52:55.063] [ERROR] [localhost] [Khirz6zTPdfd7] [uid-1737485374514] nodeJS - error downloadFile:url=http://localhost:1234/static/sample2.docx;attempt=1;code:ECONNREFUSED;connect:null Error: connect ECONNREFUSED 127.0.0.1:1234

My config =

{
        "document": {
          "fileType": "docx",
          "key": "Khirz6zTPdfd7",
          "title": "Example Document Title.docx",
          "url": "http://localhost:1234/static/sample2.docx"
        },
        "documentType": "word",
        "token": "token",
      }

I currently have a go webserver setup on localhost:1234 that has a endpoint of /static/sample2.docx which downloads sample2.docx in my downloads directory.

Golang code:

s := http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))

	r.PathPrefix("/static/").Handler(s)

This refers to a folder called static and makes it into a static file server. Any file within it can be served with a localhost:1234/static/* (can be index.html, or in my case sample2.docx). It is successful when it comes to serving my .docx file once I click on it, so I would assume that it would be successful when it comes to responding to the API. I’m either thinking there is an issue with my header (though I’m not yet sure what that would look like)

Thank you

Hello @humamdev,
Please use the domain name or IP address of the server instead of localhost in your tests. Docker container has its own localhost so the server cannot find a file at this URL http://localhost:1234/static/sample2.docx inside the container and this results in the error message.

Ok, I switched localhost with 127.0.0.1 and also made sure that the token is correct.

{
        "document": {
          "fileType": "docx",
          "key": "Khirz6zTPdfd7",
          "title": "Example Document Title.docx",
          "url": "http://127.0.0.1:1234/static/sample2.docx"
        },
        "documentType": "word", "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2N1bWVudCI6eyJmaWxlVHlwZSI6ImRvY3giLCJrZXkiOiJLaGlyejZ6VFBkZmQ3IiwidGl0bGUiOiJFeGFtcGxlIERvY3VtZW50IFRpdGxlLmRvY3giLCJ1cmwiOiJodHRwOi8vMTI3LjAuMC4xOjEyMzQvc3RhdGljL3NhbXBsZTIuZG9jeCJ9LCJkb2N1bWVudFR5cGUiOiJ3b3JkIn0.glvxDSXD0JWH8v63nHycAn69019u1HWWMElPGplhlDA",
      }

However, this is the similar error I’m getting

[2025-01-21T23:07:51.059] [ERROR] [localhost] [Khirz6zTPdfd7] [uid-1737500706036] nodeJS - error downloadFile:url=http://127.0.0.1:1234/static/sample2.docx;attempt=1;code:ECONNREFUSED;connect:null Error: connect ECONNREFUSED 127.0.0.1:1234

I made a small repo to show what my golang looks like. Hope it helps!