Error render pdf aspnet.core in docker image
-
I'm having the following error:
"Error rendering report: rendering has finished with errors:Error: An error occurred while trying to execute the command: at onCriticalError ([eval]:29603:25) at tryCatcher ([eval]:36038:23) at Promise._settlePromiseFromHandler ([eval]:34061:31) at Promise._settlePromise ([eval]:34118:18) at Promise._settlePromise0 ([eval]:34163:10) at Promise._settlePromises ([eval]:34238:18) at Async._drainQueue ([eval]:31008:16) at Async._drainQueues ([eval]:31018:10) at Immediate.Async.drainQueues [as _onImmediate] ([eval]:30892:14) at processImmediate [as _immediateCallback] (timers.js:396:17) {"originalError":{"remoteStack":"Error: Command failed: /tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/phantomjs.exe --ignore-ssl-errors=yes --web-security=false --ssl-protocol=any /tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/standaloneScript.js /tmp/jsreport/48e9d760-8aad-11e8-9682-8f763badf90dsettings.html\n/tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/phantomjs.exe: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory\n\n at ChildProcess.exithandler (child_process.js:214:12)\n at emitTwo (events.js:87:13)\n at ChildProcess.emit (events.js:172:7)\n at maybeClose (internal/child_process.js:854:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)"}}(Original) Error: Error during rendering report: Command failed: /tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/phantomjs.exe --ignore-ssl-errors=yes --web-security=false --ssl-protocol=any /tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/standaloneScript.js /tmp/jsreport/48e9d760-8aad-11e8-9682-8f763badf90dsettings.html/tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/phantomjs.exe: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory at [eval]:36644:23 at ConcatStream.<anonymous> ([eval]:42366:43) at emitNone (events.js:72:20) at ConcatStream.emit (events.js:166:7) at finishMaybe ([eval]:4229:14) at afterWrite ([eval]:4115:3) at nextTickCallbackWithManyArgs (node.js:486:18) at process._tickCallback (node.js:384:17) {"remoteStack":"Error: Command failed: /tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/phantomjs.exe --ignore-ssl-errors=yes --web-security=false --ssl-protocol=any /tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/standaloneScript.js /tmp/jsreport/48e9d760-8aad-11e8-9682-8f763badf90dsettings.html\n/tmp/jsreport/compile/jsreport-1.10.0-SkbsxfJUG/phantomjs.exe: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory\n\n at ChildProcess.exithandler (child_process.js:214:12)\n at emitTwo (events.js:87:13)\n at ChildProcess.emit (events.js:172:7)\n at maybeClose (internal/child_process.js:854:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)"}"
My startup class is like this:
services.AddJsReport(new LocalReporting()
.KillRunningJsReportProcesses()
.RunInDirectory(Path.Combine(Directory.GetCurrentDirectory(), "tmp" ,"jsreport"))
.UseBinary(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
JsReportBinary.GetBinary() : RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ?
jsreport.Binary.Linux.JsReportBinary.GetBinary() : jsreport.Binary.OSX.JsReportBinary.GetBinary())
.AsUtility()
.Create());
-
The error is hidden in the message
error while loading shared libraries: libfreetype.so.6: cannot open shared
Based on your distribution, you need to add to your docker image something like
sudo apt-get install libfreetype6 libfreetype6-dev sudo apt-get install libfontconfig1 libfontconfig1-dev