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

JWT issues, unable to view/edit attachments #23

Open
fmcsecurity opened this issue Dec 10, 2023 · 0 comments
Open

JWT issues, unable to view/edit attachments #23

fmcsecurity opened this issue Dec 10, 2023 · 0 comments

Comments

@fmcsecurity
Copy link

Hi Everyone. We're running the OnlyOffice 15.0 module on Odoo 15 CE. Everything's setup as instructed on both sides. Docserver is running perfectly with other apps such as Nextcloud. When clicking on a PDF or DOCX attachment in Odoo, we're experiencing the "Download failed" popup in the browser with the following logs:

OnlyOffice Converter – out.log:

2023-12-10T08:20:49.711] [ERROR] [localhost] [8864c4582ab35193902b2ccfe343f3309d0d99233000] [9] nodeJS - error downloadFile:url=https://odoo-server/onlyoffice/file/content/8864?oo_security_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OX0.77HMdvpnCI3NdumWP8Tf-1VB2nbRUbD33eDJIlB3MSU;attempt=1;code:undefined;connect:undefined Error: Error response: statusCode:500; headers:{"server":"nginx/1.18.0","date":"Sun, 10 Dec 2023 00:20:49 GMT","content-type":"text/html;charset=utf-8","content-length":"1810","connection":"keep-alive","set-cookie":["frontend_lang=en_GB; Path=/","session_id=7474c96dd4fe46d662a4cbfc67703a675a95c143; Expires=Sat, 09-Mar-2024 00:20:49 GMT; Max-Age=7776000; HttpOnly; Path=/"]};
at Request.fResponse (/snapshot/server/build/server/Common/sources/utils.js)
at Request.emit (events.js:400:28)
at Request.onRequestResponse (/snapshot/server/build/server/Common/node_modules/request/request.js:1059:10)
at ClientRequest.emit (events.js:400:28)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:127:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at TLSSocket.Readable.push (internal/streams/readable.js:206:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)

When directly accessing the URL above: https://odoo-server/onlyoffice/file/content/8864?oo_security_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OX0.77HMdvpnCI3NdumWP8Tf-1VB2nbRUbD33eDJIlB3MSU

The browser will show a 500 error with the following output:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 35, in onlyoffice_get_file_content
raise Exception("expected JWT")
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 35, in onlyoffice_get_file_content
raise Exception("expected JWT")
Exception: expected JWT

We tried disabling tokens in the local.json configuration and removed the JWT secret from the Odoo configuration. Accessing the URL above from a browser logged into Odoo results in a download (without the OnlyOffice interface). However, from a different machine, it displays a 500 error with the following in the Odoo log:

2023-12-10 03:05:42,669 1507395 ERROR odoo odoo.addons.http_routing.models.ir_http: 500 Internal Server Error:

Traceback (most recent call last):
File "/usr/lib/python3.9/base64.py", line 43, in _bytes_from_decode_data
return memoryview(s).tobytes()
TypeError: memoryview: a bytes-like object is required, not 'NoneType'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 41, in onlyoffice_get_file_content
content_base64 = base64.b64decode(content)
File "/usr/lib/python3.9/base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "/usr/lib/python3.9/base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 815, in dispatch
r = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/onlyoffice_odoo/controllers/controllers.py", line 41, in onlyoffice_get_file_content
content_base64 = base64.b64decode(content)
File "/usr/lib/python3.9/base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "/usr/lib/python3.9/base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'

Odoo & OnlyOffice are running on the same machine, both behind a Nginx proxy. They are being accessed from a remote network. We tried running a bare minimum Nginx configuration with the same results.

Any ideas? Happy to assist with the debugging process, thanks!

@fmcsecurity fmcsecurity changed the title JWT JWT issues, unable to view/edit attachments Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant