BlueTeaLondon / heroku-buildpack-libreoffice-for-heroku-18

Other
17 stars 31 forks source link

Fails for heroku-24 stack due to updated runtime environemnt #26

Open NathanHam16 opened 3 months ago

NathanHam16 commented 3 months ago

Issue: After upgrading from heroku-22 to heroku-24 stack, without changing any code, what was working now fails in production due to what seems to be a updated runtime environement causing the error.

Code:


    command = ['soffice', '--headless', '--convert-to', 'pdf', '--outdir', output_dir, docx_path]
    try:
        result = subprocess.run(command, capture_output=True, text=True, check=True)
        print("Conversion attempted.", result.stdout)
        return result
    except subprocess.CalledProcessError as e:
        print(f"Error during conversion: {e}")
        print(f"Return code: {e.returncode}")
        print(f"stdout: {e.stdout}")
        print(f"stderr: {e.stderr}")
        raise  # Re-raise the exception after logging```

Error log:
```2024-07-15T01:33:57.797861+00:00 app[web.1]: Return code: 127   
2024-07-15T01:33:57.797902+00:00 app[web.1]: stdout:
2024-07-15T01:33:57.797914+00:00 app[web.1]: stderr: javaldx: Could not find a Java Runtime Environment!
2024-07-15T01:33:57.797915+00:00 app[web.1]: Warning: failed to read path from javaldx
2024-07-15T01:33:57.797916+00:00 app[web.1]: /app/vendor/libreoffice/opt/libreoffice7.3/program/soffice.bin: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory
2024-07-15T01:33:57.797926+00:00 app[web.1]:
2024-07-15T01:33:57.797974+00:00 app[web.1]: Error during conversion: Command '['soffice', '--headless', '--convert-to', 'pdf', '--outdir', '/tmp/tmpm5yksc8s', '/tmp/tmpm5yksc8s/temp.docx']' returned non-zero exit status 127.```
Nerian commented 2 months ago

@NathanHam16 I am having the same issue. Did you figure out a solution?

NathanHam16 commented 2 months ago

@Nerian No solution, just downgraded to heroku-22

RonaldoSchork commented 2 months ago

Hi, I was having the same problem.

Add the "libcups2" to the Aptfile and redeploy the application. It worked for me.