Dear Support,
I want to integrate document server as an office-file viewer. I’ve tried to build a simple-small html to test open a word file, everything is ok, but after I change the file to pdf, the browser just throw an error:An error has occurred while opening the file.
in Browser’s F12 mode, the error is like below:
Uncaught TypeError: Cannot read properties of undefined (reading ‘skb’)
at window.AscPDF.neg (sdk-all.js:13353:345)
at e.$ri (sdk-all-min.js:1953:72)
at b.Re (sdk-all.js:13283:400)
at d.GIa (sdk-all.js:12459:380)
at d.Hqd (sdk-all.js:12409:10)
at d.B_f (sdk-all.js:12408:438)
at d.Vqi (sdk-all.js:12408:316)
at sdk-all.js:12417:13
my little test html is like below:
ONLYOFFICE Document Editor
<script type="text/javascript" src="http://docker-based-LAN-server/web-apps/apps/api/documents/api.js"></script>
<script>
const docEditor = new DocsAPI.DocEditor("placeholder", {
document: {
fileType: "pdf",
key: "Khirz6zTPdff1",
permissions: {
edit: false,
},
title: "aaa.pdf",
url: "http://nginx-hosted-LAN-server/aaa.pdf",
},
documentType: "pdf",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb2N1bWVudCI6eyJmaWxlVHlwZSI6InBkZiIsImtleSI6IktoaXJ6NnpUUGRmZjEiLCJ0aXRsZSI6IndlY2hhdC5wZGYiLCJwZXJtaXNzaW9ucyI6eyJlZGl0IjpmYWxzZX0sInVybCI6Imh0dHA6Ly8xMC4xNjguMS43MS93ZWNoYXQucGRmIn0sImRvY3VtZW50VHlwZSI6InBkZiJ9.fhO0_8SKU-elYYKiUfp_lQAcBct258Trx7Bj0496Mlg",
});
</script>
PS: all my doc file and pdf file is hosted at the same directory, and can be direct access by web browser.
Please help me out, thanks.
forgot to mention, the key and token are manually refreshed in every test cycle, so it i think it might not the unique-key related problem.
document server version: I’ve tested 8.3.2 and 8.3.1, same error.
Hello @JoshuaChang,
Does the issue occur when opening all pdf files?
Please provide full Document Server logs as file after the issue reproduction (/var/log/onlyoffice/documentserver, for Docker - inside the container)
Dear @DmitriiV
-
I’ve tested several pdf files(from 500K to 20M), all of them throw the same error.
-
under /var/log/onlyoffice/documentserver/docservice/, the out.log have error like below:
[2025-03-26T09:39:08.475] [ERROR] [localhost] [Khirz6zTPdfe4] [uid-17429757230911] nodeJS - clientLog: changesError: Error: Uncaught TypeError: Cannot read properties of undefined (reading ‘Kkb’)
Script: http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js
Line: 13360:345
userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0
platform: Win32
isLoadFullApi: true
isDocumentLoadComplete: false
DocumentInfo:
Selection: false
performance.memory: {“totalJSHeapSize”:124474328,“usedJSHeapSize”:96651028,“jsHeapSizeLimit”:4294705152}
StackTrace: TypeError: Cannot read properties of undefined (reading ‘Kkb’)
at window.AscPDF.Meg (http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js:13360:345)
at e.Hsi (http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all-min.js:1953:72)
at b.Re (http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js:13290:400)
at d.OIa (http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js:12465:380)
at d.hrd (http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js:12415:10)
at d.$_f (http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js:12414:438)
at d.Fri (http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js:12414:316)
at http://document-server-ip/8.3.2-a404037cca330194fb4342757634c059/sdkjs/word/sdk-all.js:12423:13
-
under /var/log/onlyoffice/documentserver/, the nginx.error.log have error like below:
2025/03/26 09:39:10 [error] 12048#12048: *954 open() “/var/www/onlyoffice/documentserver/web-apps/vendor/socketio/socket.io.min.js.map” failed (2: No such file or directory), client: my-client-ip, server: , request: “GET /8.3.2-a404037cca330194fb4342757634c059/web-apps/vendor/socketio/socket.io.min.js.map HTTP/1.1”, host: “document-server-ip”
-
I’ve checked /var/www/onlyoffice/documentserver/web-apps/vendor/socketio/, there are only 2 files: socket.io.min.js, socket.io.min.js.gz
I have no idea what’s happended and don’t know whether the errors above have connection, if you need any other detailed information, let me know.
Thank you.
I’ve figured it out, under document setting, if no height and width parameter, pdf file will throw error(docx file is ok)
so the correct config should be like below:
const docEditor = new DocsAPI.DocEditor(“placeholder”, {
document: {
fileType: “pdf”,
key: “Khirz6zTPdff1”,
permissions: {
edit: false,
},
title: “aaa.pdf”,
url: “http://nginx-hosted-LAN-server/aaa.pdf”,
},
height: “550px”,
width: “100%”,
documentType: “pdf”,
token: “generated-token”,
});
So, is the issue resolved now?
Is is rather unusual, I’ve just tested the config without width and height parameters and random pdf file that I used for testing opened without any errors.
In general, it is recommended to specify as many parameters as possible in the config
Yes, resolved. Thank you all the same.
1 Like