Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to connect (Error occurred in the document service: Error while downloading the document file to be converted.) #278

Open
xlangyun opened this issue Aug 12, 2019 · 10 comments

Comments

@xlangyun
Copy link

Do you want to request a feature or report a bug?

What is the current behavior?
/var/log/onlyoffice/documentserver/converter/out.log
[2019-08-12T21:48:03.765] [ERROR] nodeJS - error downloadFile:url=http://10.10.10.223/index.php/apps/onlyoffice/empty?doc=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJlbXB0eSJ9.FZwXATHSHK9nqy8GCbVmXkTA8QkkvZ7Mvn89diwM_Hk;attempt=3;code:null;connect:null;(id=conv_check_284448135_docx)^M
Error: Error response: statusCode:403 ;body:^M
{"message":"Access denied"}
at Request._callback (/var/www/onlyoffice/documentserver/server/Common/sources/utils.js:256:18)
at Request.self.callback (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request. (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1161:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage. (/var/www/onlyoffice/documentserver/server/Common/node_modules/request/request.js:1083:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:978:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)

[2019-08-12T22:03:47.609] [WARN] nodeJS - worker 66528 died (code = 1; signal = null). restart...
[2019-08-12T22:03:48.047] [WARN] nodeJS - worker 66536 died (code = 1; signal = null). restart...
[2019-08-12T22:03:48.805] [WARN] nodeJS - worker 66542 died (code = 1; signal = null). restart...
[2019-08-12T22:03:49.622] [WARN] nodeJS - worker 66549 died (code = 1; signal = null). restart...
[2019-08-12T22:03:50.250] [WARN] nodeJS - worker 66555 died (code = 1; signal = null). restart...
[2019-08-12T22:03:50.974] [WARN] nodeJS - worker 66561 died (code = 1; signal = null). restart...
[2019-08-12T22:03:51.395] [WARN] nodeJS - worker 66567 died (code = 1; signal = null). restart...
[2019-08-12T22:03:51.874] [WARN] nodeJS - worker 66573 died (code = 1; signal = null). restart...
[2019-08-12T22:03:52.292] [WARN] nodeJS - worker 66579 died (code = 1; signal = null). restart...
[2019-08-12T22:03:52.815] [WARN] nodeJS - worker 66585 died (code = 1; signal = null). restart...
[2019-08-12T22:03:53.272] [WARN] nodeJS - worker 66591 died (code = 1; signal = null). restart...
[2019-08-12T22:03:53.798] [WARN] nodeJS - worker 66597 died (code = 1; signal = null). restart...
[2019-08-12T22:03:54.374] [WARN] nodeJS - worker 66603 died (code = 1; signal = null). restart...
[2019-08-12T22:03:54.905] [WARN] nodeJS - worker 66610 died (code = 1; signal = null). restart...
[2019-08-12T22:03:55.364] [WARN] nodeJS - worker 66616 died (code = 1; signal = null). restart...
[2019-08-12T22:03:55.783] [WARN] nodeJS - worker 66622 died (code = 1; signal = null). restart...
[2019-08-12T22:03:56.210] [WARN] nodeJS - worker 66628 died (code = 1; signal = null). restart...
[2019-08-12T22:03:56.715] [WARN] nodeJS - worker 66634 died (code = 1; signal = null). restart...
[2019-08-12T22:03:57.162] [WARN] nodeJS - worker 66640 died (code = 1; signal = null). restart...
[2019-08-12T22:03:57.639] [WARN] nodeJS - worker 66646 died (code = 1; signal = null). restart...
[2019-08-12T22:03:58.043] [WARN] nodeJS - worker 66654 died (code = 1; signal = null). restart...
[2019-08-12T22:03:58.458] [WARN] nodeJS - worker 66660 died (code = 1; signal = null). restart...
[2019-08-12T22:03:58.908] [WARN] nodeJS - worker 66666 died (code = 1; signal = null). restart...
[2019-08-12T22:03:59.327] [WARN] nodeJS - worker 66672 died (code = 1; signal = null). restart..

Error: Module version mismatch. Expected 48, got 57.
at Error (native)
at Object.Module._extensions..node (module.js:604:18)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/var/www/onlyoffice/documentserver/server/SpellChecker/sources/spellCheck.js:13:17)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
module.js:604
return process.dlopen(module, path._makeLong(filename));

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior?

Did this work in previous versions of DocumentServer?

DocumentServer version:
My owncloud version is 10.0.0
I used this cmd to install DS yestoday(sudo yum install onlyoffice-documentserver).
Operating System:
Centos 7
Browser version:

@ShockwaveNN ShockwaveNN transferred this issue from ONLYOFFICE/DocumentServer Aug 12, 2019
@HelenBelova17
Copy link
Member

Hello, @xlangyun, attach screenshot the page of Onlyoffice Server settings.

@LinneyS
Copy link
Member

LinneyS commented Dec 26, 2019

Could you please specify if the problem recurs?

@ghost
Copy link

ghost commented Mar 5, 2020

I can't get pass this thing!
Screenshot from 2020-03-04 21-34-13

@alexanderonlyoffice
Copy link

@cldtech, if your Document Server and ownCloud are publicly accessible via domain names, there is no need to use 'Advanced server settings' - please disable this section. Please check also JWT settings:

  1. Open /etc/onlyoffice/documentserver/local.json and find the following section:
 "inbox": {
          "header": "JWT_header"
        },
        "outbox": {
          "header": "JWT_header"
        }
      },
      "secret": {
        "inbox": {
          "string": "JWT_secret"
        },
        "outbox": {
          "string": "JWT_secret"
        },
        "session": {
          "string": "JWT_secret"
  1. Add the following section to config.php of ownCloud:
'onlyoffice' =>
  array (
    "jwt_secret" => "JWT_secret",
    "jwt_header" => "JWT_header"
	)

Where under JWT_secret and JWT_header are the corresponding values from local.json
3. Then click on the 'Save' button on the integration app settings page.

If this doesn't help, please check the accessibility of the Document Server and ownCloud to each other with wget command. On the server with Document Server wget https://owncloud_address and wget https://documentserver_address on the machine with ownCloud.

Specify also what SSL certificates are used on both servers.

@ghost
Copy link

ghost commented Mar 6, 2020

@cldtech, if your Document Server and ownCloud are publicly accessible via domain names, there is no need to use 'Advanced server settings' - please disable this section. Please check also JWT settings:

1. Open /etc/onlyoffice/documentserver/local.json and find the following section:
 "inbox": {
          "header": "JWT_header"
        },
        "outbox": {
          "header": "JWT_header"
        }
      },
      "secret": {
        "inbox": {
          "string": "JWT_secret"
        },
        "outbox": {
          "string": "JWT_secret"
        },
        "session": {
          "string": "JWT_secret"
1. Add the following section to config.php of ownCloud:
'onlyoffice' =>
  array (
    "jwt_secret" => "JWT_secret",
    "jwt_header" => "JWT_header"
	)

Where under JWT_secret and JWT_header are the corresponding values from local.json
3. Then click on the 'Save' button on the integration app settings page.

If this doesn't help, please check the accessibility of the Document Server and ownCloud to each other with wget command. On the server with Document Server wget https://owncloud_address and wget https://documentserver_address on the machine with ownCloud.

Specify also what SSL certificates are used on both servers.

Here is what i have, this is the layout i got with fresh installs and i only changed values as said here.

config.php

'onlyoffice' => 
  array (
    'verify_peer_off' => true,
    'jwt_secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    'jwt_header' => 'AuthorizationJwt',
  ),

local.json

"services": {
	"CoAuthoring": {
		"sql": {
			"type": "mysql",
			"dbPort": 3307,
			"dbPass": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
			"charset": "utf8"
		},
		"secret": {
			"browser": {"string": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "file": "", "tenants": {}},
			"inbox": {"string": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "file": "", "tenants": {}},
			"outbox": {"string": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "file": ""},
			"session": {"string": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "file": ""}
		},
		"token": {
			"enable": {
				"browser": false,
				"request": {
					"inbox": false,
					"outbox": false
				}
			},
			"inbox": {
				"header": "AuthorizationJwt"
			},
			"outbox": {
				"header": "AuthorizationJwt"
			}
		}
	}
}

It's a self-signed certificate that's why 'verify_peer_off' => true, which resolve the first error i had.
I thought it was obvious because i got here with a google search "onlyoffice-ds self-signed certificate" and didn't realize it wasn't even the title. Apologies 🤦‍♂️
Oh and the document server does shoe the "Document Server is running" every time i try.

@tititototutu
Copy link

Hello,
I just solved a fairly similar problem.
The problem was caused by a bad time synchronization between the owncloud server and the onlyoffice document server. JWT tokens are only valid for 5 minutes.
Check the NTP time synchro and the timezone of the servers.
Good luck.

@rose-a
Copy link

rose-a commented Jan 19, 2021

Im experiencing the time-sync problem, too. Unfortunately I've got no control over the system time on the server serving my nextcloud instance (managed webhost). Since the nextcloud server lags behind the JWTs from onlyoffice are "not yet valid". This is a matter of ~1 to 2 seconds!

Is there a way to get around this?

@CL-Jeremy
Copy link

@rose-a Your best bet would be to modify apps/onlyoffice/3rdparty/jwt/JWT.php and change the value of $leeway to, say, 3. Note that if you have configured updating apps routinely via cron job, you'll have to repeat this each time the app gets updated.

@anon8675309
Copy link

I can reproduce this problem and confirm that setting the leeway resolves it.

To get this issue closed out properly, would it be acceptable to expose the $leeway setting to the onlyoffice settings page under the "Advanced server settings" of the "Server settings" section?

This would cause the field to be hidden by default so it doesn't cause confusion. The default value could remain at zero for backward compatibility.

anon8675309 pushed a commit to anon8675309/onlyoffice-nextcloud that referenced this issue Oct 25, 2022
If the system clock of the document server is even a second slower than the
nextcloud server, the JWT token will be rejected as being "not yet valid". This
can be seen in the logs (Nextcloud -> Settings -> Administration -> Logging).

The error message shown to the user when this happens is more generic:

"Error when trying to connect (Error occurred in the document service: Error
while downloading the document file to be converted.)"

This error message has been reported on the bug tracker several times, but it is
not clear when the connection failure was due to imperfectly synchronized clocks
and when it was due to network connectivity, DNS issues, the JWT not being sent,
the secret being wrong, or some other issue.

Here are the tickets that may be fixed by this:
ONLYOFFICE#345
ONLYOFFICE#548
ONLYOFFICE#315
ONLYOFFICE#290
ONLYOFFICE#127

There's also one on the owncloud fork that may be fixed by this as well:
ONLYOFFICE/onlyoffice-owncloud#278
@NitrinCloud
Copy link

I can reproduce this problem and confirm that setting the leeway resolves it.

To get this issue closed out properly, would it be acceptable to expose the $leeway setting to the onlyoffice settings page under the "Advanced server settings" of the "Server settings" section?

This would cause the field to be hidden by default so it doesn't cause confusion. The default value could remain at zero for backward compatibility.

This sadly doesn't fix the issue on my side

LinneyS pushed a commit to ONLYOFFICE/onlyoffice-nextcloud that referenced this issue Feb 25, 2023
If the system clock of the document server is even a second slower than the
nextcloud server, the JWT token will be rejected as being "not yet valid". This
can be seen in the logs (Nextcloud -> Settings -> Administration -> Logging).

The error message shown to the user when this happens is more generic:

"Error when trying to connect (Error occurred in the document service: Error
while downloading the document file to be converted.)"

This error message has been reported on the bug tracker several times, but it is
not clear when the connection failure was due to imperfectly synchronized clocks
and when it was due to network connectivity, DNS issues, the JWT not being sent,
the secret being wrong, or some other issue.

Here are the tickets that may be fixed by this:
#345
#548
#315
#290
#127

There's also one on the owncloud fork that may be fixed by this as well:
ONLYOFFICE/onlyoffice-owncloud#278
LinneyS pushed a commit to ONLYOFFICE/onlyoffice-nextcloud that referenced this issue Mar 29, 2023
If the system clock of the document server is even a second slower than the
nextcloud server, the JWT token will be rejected as being "not yet valid". This
can be seen in the logs (Nextcloud -> Settings -> Administration -> Logging).

The error message shown to the user when this happens is more generic:

"Error when trying to connect (Error occurred in the document service: Error
while downloading the document file to be converted.)"

This error message has been reported on the bug tracker several times, but it is
not clear when the connection failure was due to imperfectly synchronized clocks
and when it was due to network connectivity, DNS issues, the JWT not being sent,
the secret being wrong, or some other issue.

Here are the tickets that may be fixed by this:
#345
#548
#315
#290
#127

There's also one on the owncloud fork that may be fixed by this as well:
ONLYOFFICE/onlyoffice-owncloud#278
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants