ConvertService don't convert to PDF with error -4

Hello!

I have a problem. I use local storage to original files to optimize open document timing. It’s work successful. And I need to convert PPTX files to PDF as intermediate form before sliding as PDF files per page. Files will be available at GET http://web/files/open?id=1&token=. i check access with use

sudo docker exec onlyoffice curl -o /tmp/file.pptx "http://web/files/open?id=1&token=<token>"

command and it is dowloaded success.

I use this script for this purpose:

/** @param LocalStorage $s Class what get a link like 'http://web/files/open?id=<id>&token=<bearer token>' for access to open file. It's used in OnlyOffice Editor
 * @param string $bucket It's root directory.
 * @param string $s3_key Rest of file path
 */
public static function convertToPdf(LocalStorage $s, $bucket, $s3_key) {
        $url = $s->generatePresignedUrl('GetObject', $bucket, $s3_key, "+20 minutes");
        $payload = [
            "async" => false,
            "filetype" => pathinfo($s3_key, PATHINFO_EXTENSION),
            "outputtype" => "pdf",
            "url" => $url,
            "key" => Yii::$app->security->generateRandomString(20),
        ];
        $client = new Client();
        $response = $client->post(self::DOC_SERV_CONVERTER_URL, json_encode($payload), ['accept' => 'application/json'])->send();

        if ($response->isOk && !isset($response->data['error']))
            return $response->data['fileUrl'];

        throw new ServerErrorHttpException("Не удалось конвертировать файл: " . $response->data['error']);
    }

But I take error -4 at any time. What is description of this error? I think, what it can be extension-less file name is reason. Can it be another reason?

Server configuration:

DocumentBuilder version: 7.0.1.37
Docker containers: web (Nginx), php, onlyoffice.
OS: Debian Linux

Thanks for answer,
Dmitry

Local storage module return file as octet-stream with this headers:


File opens in editor, but ConvertService.ashx can’t be read a file.

I try set a MIME type of file in request:


but it not work.


I can’t connect to the service, but ping for it is OK:

Hi @DEMo :wave:

https://api.onlyoffice.com/editors/conversionapi#error-codes

Error -4 indicates that there was an issue while downloading the document file for conversion.

Hi, @Nikolas :wave:

I defined each error codes into code, thanks. How headers DocumentServer.ashx must take to accept file for conversion? I use application/octet-stream and docx/pptx MIME type, but it’s not work.

@DEMo
Wait, have you resolved the issue with error -4?

Hi!

No, I make a user-oriented text for error message, but problem is not resolved.

When sending requests through Postman, I’m using the standard parameters.

Error -4 - the file was not received by the conversion service. Apparently, there are network issues.
Is your DS located in Docker?

image

Hi!

I’m not solved in local, but on test server it’s work with ‘onlyoffice/ConvertService.ashx’ address. But I have a new problem: something files not converted by error ‘time out’.
My configuration:

     "FileConverter": {
                "converter": {
                        "maxDownloadBytes": 524288000,
                        "downloadTimeout": {
                                "connectionAndInactivity": "20s",
                                "wholeCycle": "40s"
                        },
                        "downloadAttemptMaxCount": 3,
                        "downloadAttemptDelay": 1000,
                        "maxprocesscount": 1,
                        "fontDir": "null",
                        "presentationThemesDir": "null",
                        "x2tPath": "null",
                        "docbuilderPath": "null",
                        "docbuilderAllFontsPath": "null",
                        "args": "",
                        "spawnOptions": {},
                        "errorfiles": "",
                        "streamWriterBufferSize": 8388608,
                        "maxRedeliveredCount": 2,
                        "inputLimits": [
                                {
                                "type": "docx;dotx;docm;dotm",
                                "zip": {
                                        "uncompressed": "50MB",
                                        "template": "*.xml"
                                }
                                },
                                {
                                "type": "xlsx;xltx;xlsm;xltm",
                                "zip": {
                                        "uncompressed": "512MB",
                                        "template": "*.xml"
                                }
                                },
                                {
                                "type": "pptx;ppsx;potx;pptm;ppsm;potm",
                                "zip": {
                                        "uncompressed": "500MB",
                                        "template": "*.xml"
                                }
                                }
                        ]
                }
        }

I try drop volume ‘onlyoffice’ to update of etc/onlyoffice/documentserver/default.json.

docker start+stop

is not resolve this before. Converter up configuration, but fail each converting with error -4, config:

"FileConverter": {
		"converter": {
			"maxDownloadBytes": 524288000,
			"downloadTimeout": {
				"connectionAndInactivity": "20s",
				"wholeCycle": "40s"
			},
			"downloadAttemptMaxCount": 3,
			"downloadAttemptDelay": 1000,
			"maxprocesscount": 1,
			"fontDir": "null",
			"presentationThemesDir": "null",
			"x2tPath": "null",
			"docbuilderPath": "null",
			"docbuilderAllFontsPath": "null",
			"args": "",
			"spawnOptions": {},
			"errorfiles": "",
			"streamWriterBufferSize": 8388608,
			"maxRedeliveredCount": 2,
			"inputLimits": [
				{
				"type": "docx;dotx;docm;dotm",
				"zip": {
					"uncompressed": "50MB",
					"template": "*.xml"
				}
				},
				{
				"type": "xlsx;xltx;xlsm;xltm",
				"zip": {
					"uncompressed": "512MB",
					"template": "*.xml"
				}
				},
				{
				"type": "pptx;ppsx;potx;pptm;ppsm;potm",
				"zip": {
					"uncompressed": "500MB",
					"template": "*.xml"
				}
				}
			]
		}
	}

I use

docker-compose down; docker-compose up -d

container had build again, but it not fixed error -4.
Config by default is

"FileConverter": {
                "converter": {
                        "maxDownloadBytes": 104857600,
                        "downloadTimeout": {
                                "connectionAndInactivity": "2m",
                                "wholeCycle": "2m"
                        },
                        "downloadAttemptMaxCount": 3,
                        "downloadAttemptDelay": 1000,
                        "maxprocesscount": 1,
                        "fontDir": "null",
                        "presentationThemesDir": "null",
                        "x2tPath": "null",
                        "docbuilderPath": "null",
                        "args": "",
                        "spawnOptions": {},
                        "errorfiles": "",
                        "streamWriterBufferSize": 8388608,
                        "maxRedeliveredCount": 2,
                        "inputLimits": [
                                {
                                "type": "docx;dotx;docm;dotm",
                                "zip": {
                                        "uncompressed": "50MB",
                                        "template": "*.xml"
                                }
                                },
                                {
                                "type": "xlsx;xltx;xlsm;xltm",
                                "zip": {
                                        "uncompressed": "300MB",
                                        "template": "*.xml"
                                }
                                },
                                {
                                "type": "pptx;ppsx;potx;pptm;ppsm;potm",
                                "zip": {
                                        "uncompressed": "50MB",
                                        "template": "*.xml"
                                }
                                }
                        ]
                }
        }

Where can I must search resolve? What can be a solution in this problem iteration?


Curious.

I try use volume and self-directing URL’s to loading files as local. it’s not works too. And I check what this URL’s is correct too:

Hello!

Can I allow local address for open files in Docker-based OnlyOffice (for edit and ConvertService) in configuration? I hasn’t found article with this information.

@DEMo
It seems like this issue is related to a private IP address.

Try Carl’s solution:

Thanks, it fix access.

I try configuration of docker container 'onlyoffice to convert a large (100+ MB) files to PDF. Outer Nginx server configured with

proxy_read_timeout 3600;

option at OnlyOffice domain and PHP domain (with functionality of local storage) too.

default.json configuration contains next section:

       "FileConverter": {
		"converter": {
			"maxDownloadBytes": 524288000,
			"downloadTimeout": {
				"connectionAndInactivity": "30s",
				"wholeCycle": "2m"
			},
			"downloadAttemptMaxCount": 3,
			"downloadAttemptDelay": 1000,
			"maxprocesscount": 1,
			"fontDir": "null",
			"presentationThemesDir": "null",
			"x2tPath": "null",
			"docbuilderPath": "null",
			"docbuilderAllFontsPath": "null",
			"args": "",
			"spawnOptions": {},
			"errorfiles": "",
			"streamWriterBufferSize": 8388608,
			"maxRedeliveredCount": 2,
			"inputLimits": [
				{
				"type": "docx;dotx;docm;dotm",
				"zip": {
					"uncompressed": "300MB",
					"template": "*.xml"
				}
				},
				{
				"type": "xlsx;xltx;xlsm;xltm",
				"zip": {
					"uncompressed": "512MB",
					"template": "*.xml"
				}
				},
				{
				"type": "pptx;ppsx;potx;pptm;ppsm;potm",
				"zip": {
					"uncompressed": "500MB",
					"template": "*.xml"
				}
				}
			]
		}
	},

I try replace OnlyOffice inner nginx default configuration use it:

server {
       listen 80 default_server;
       listen [::]:80 default_server;
       root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name _;
        client_max_body_size 512m;
        fastcgi_read_timeout 600;

        location / {
                try_files $uri $uri/ =404;   
        }
}

but error Connection timed out is not lost after. I select a true way to solute?

Hello @DEMo :saluting_face:

  1. Please create a new topic with a description of the issue (to avoid mixing everything in one topic).
  2. You can send the document server logs so we can confirm if the issue is related to the proxy.
  3. The default.json settings appear to be correct if your files are not larger than 500 MB (depends on the sizes of all .xml files in the document).
  4. Specify the version of your document server. Currently, the latest version is 8.0.0. :upside_down_face:
1 Like