Generating PDF with unoconv is broken in JS-report 4.9 and later



  • We recently upgraded our dev environment from JS-report 4.6 to v4.9. And generating a PDF with unoconv no longer works.
    We have a minimal example with a word docx template and some simple JSON data that form an example resume.
    When running this example we now get the following error:

    Report "CV" render failed.
    
    Error while executing unoconv
    (because) command failed: /usr/bin/timeout 30 flock -w 20 lockfile /usr/bin/unoconv -f pdf /tmp/jsreport/autocleanup/7dd511a6-9190-4ac2-9185-67779ba57259.docx
    Traceback (most recent call last):
      File "/usr/bin/unoconv", line 19, in 
        from distutils.version import LooseVersion
    ModuleNotFoundError: No module named 'distutils'
    
    Error: Command failed: /usr/bin/timeout 30 flock -w 20 lockfile /usr/bin/unoconv -f pdf /tmp/jsreport/autocleanup/7dd511a6-9190-4ac2-9185-67779ba57259.docx
    Traceback (most recent call last):
      File "/usr/bin/unoconv", line 19, in 
        from distutils.version import LooseVersion
    ModuleNotFoundError: No module named 'distutils'
    
      at genericNodeError (node:internal/errors:983:15)
      at wrappedFn (node:internal/errors:537:14)
      at ChildProcess.exithandler (node:child_process:415:12)
      at ChildProcess.emit (node:events:518:28)
      at maybeClose (node:internal/child_process:1101:16)
      at ChildProcess._handle.onexit (node:internal/child_process:304:5)
      at Process.callbackTrampoline (node:internal/async_hooks:130:17)
    wrapped by:
    Error: Error while executing unoconv
    (because) command failed: /usr/bin/timeout 30 flock -w 20 lockfile /usr/bin/unoconv -f pdf /tmp/jsreport/autocleanup/7dd511a6-9190-4ac2-9185-67779ba57259.docx
    Traceback (most recent call last):
      File "/usr/bin/unoconv", line 19, in 
        from distutils.version import LooseVersion
    ModuleNotFoundError: No module named 'distutils'
    
      at module.exports (/app/node_modules/@jsreport/jsreport-core/lib/shared/createError.js:10:13)
      at WorkerReporter.createError (/app/node_modules/@jsreport/jsreport-core/lib/shared/reporter.js:53:12)
      at AsyncFunction. (/app/node_modules/@jsreport/jsreport-unoconv/lib/worker.js:49:22)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async ListenerCollection.fire (/app/node_modules/@jsreport/jsreport-core/lib/shared/listenerCollection.js:157:21)
      at async afterRender (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:102:5)
      at async WorkerReporter._render (/app/node_modules/@jsreport/jsreport-core/lib/worker/render/render.js:149:7)
      at async /app/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js:233:24
      at async processAndResponse (/app/node_modules/@jsreport/advanced-workers/lib/workerHandler.js:42:17)
    

    I also tried the most recent v4.10 and we still have the same issue. We are using the jsreport/jsreport:4.10.0-full image.

    0_1753877381381_upload-be1cd662-c289-4455-8d02-2fbb9e557d51

    If I deselct unoconv below, it renders the docx template correctly as a docx but we need it in pdf format.
    Can you recommend any solutions to this?



  • I've pushed the fixed jsreport/jsreport:4.10.0-full
    Please clean your images cache and try it again.

    Note that the unoconv extension is deprecated. You should use libreoffice extension instead.
    https://jsreport.net/learn/libreoffice



  • Thank you. This fixed the issue👍


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.