Error rendering report on CentOs 7



  • This is the message I saw at the terminal. I use it as Utility but if I use it as webserver get another kind of error.
    I publish my app as SCD with "dotnet publish -c Release -r centos.7-x64 -o c:\tmp\myApp" then upload it on the server via filezilla
    Where I can find the jsreport logs ? I'm not so skilled with Linux


  • administrators

    This is the message I saw at the terminal. I use it as Utility but if I use it as webserver get another kind of error.
    I publish my app as SCD with "dotnet publish -c Release -r centos.7-x64 -o c:\tmp\myApp" then upload it on the server via filezilla

    i think that the problem is that your app is using the default jsreport.Binary package which is the jsreport executable for windows, this works as expected in your dev machine (becase it is windows) but when you deploy to a CentOs server (linux) you need to use the jsreport executable for linux which you can find in jsreport.Binary.Linux nuget package, just install it and it should work when you build and deploy to the linux server. i'm not too familiar with .net but i think that you can have both executable and make a condition to choose which executable to pick based on a configuration or just by detecting the OS.

    Where I can find the jsreport logs ? I'm not so skilled with Linux

    for this i think you will need to create a jsreport.config.json in the jsreport folder of your project and then add some logging configuration to save logs to a file, that would help you to inspect jsreport logs when you have some troubles.



  • Well "-r centos.7-x64" in the "dotnet publish" command restore the correct packages so I suppose the binary are correct



  • got "One or more errors occurred. (Error rendering report: )"

    The actual error is usually deep down. Print the whole message because it contains all logs from the particular request.

    Well "-r centos.7-x64" in the "dotnet publish" command restore the correct packages so I suppose the binary are correct

    This has nothing to do with choosing the correct binary. You need to reference both and choose the right one in the runtime. See this in the docs.


    Centos may need some additional low level libs for rendering the pdf. You may try this

    sudo yum install bzip2 libXext  libXrender  fontconfig  libfontconfig.so.1 urw-fonts
    


  • Wel, it seem I need to study more in deep net core ... as many other things :D

    After your suggestions now I receive:
    One or more errors occurred. (Permission denied) - at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
    The code that generate this is :
    var CustomRenderRequest = new RenderRequest()
    {
    Template = new Template()
    {
    Content = email.Attachment,
    Engine = Engine.None,
    Recipe = Recipe.PhantomPdf
    }
    };
    var customReport = rs.RenderAsync(CustomRenderRequest).Result;

    My question is: how can it render without a screen ?

    PS: if I use this raw code I can create the pdf
    ar p = new Process();
    p.StartInfo = new ProcessStartInfo()
    {
    FileName = "google-chrome",
    Arguments = "--headless --disable-gpu --print-to-pdf="/tmp/zkmf/zkmf_receipt.pdf" /tmp/zkmf/zkmf_receipt.html"
    };
    p.Start();
    p.WaitForExit();



  • Same problem on Ubuntu server.

    More detailed error info:

    One or more errors occurred. (Permission denied) - System.ComponentModel.Win32Exception (0x80004005): Permission denied
    at Interop.Sys.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Int32& lpChildPid, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd)
    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
    at System.Diagnostics.Process.Start()
    at jsreport.Local.Internal.BinaryProcess.<InnerExecute>d__18.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at jsreport.Local.Internal.BinaryProcess.<ExecuteExe>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
    at jsreport.Local.Internal.LocalUtilityReportingService.<RenderAsync>d__10.MoveNext() - at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
    at zkmf_mailbot2.Program.Main(String[] args) in C:\Data\Projects\Iason\zkmfsrv\zkmf-email\zkmf-mailbot2\Program.cs:line 167



  • Hm. Not sure how to proceed with this. It would help if you would prepare for me a way how to replicate this. Like a minimal project that I can try to run on ubuntu.
    However I guess there is a problem rather with server set up. The best would be if you would prepare a dockerfile i can try to use and replicate the issue.



  • Uhm ... how can I create a docker file ? I can google a bit, but if u have short instructions I'll do my best to create it.



  • Give me a moment, I will give you some hints.



  • I prepared repository showing how can jsreport run on ubuntu docker container. You can open it in VS and just hit F5 to see it working,
    https://github.com/pofider/jsreport-net-core-docker

    You will be mainly interested in the dockerfile which describe the steps how is .net core initialized on the fresh ubuntu and how it starts the .net core app.



  • Well, just installed Docker ... How to run on container from VS 2017 Pro ?

    But my question is: how can I 100% reproduce my AWS server with Docker, if I really can ?



  • Well, just installed Docker ... How to run on container from VS 2017 Pro ?

    You should be able just to F5 my example solution. Here are the docs to vs tools for docker

    But my question is: how can I 100% reproduce my AWS server with Docker, if I really can ?

    There are usually some community docker images which tries to reflect the AWS linux images. However I have no experience with that.
    What kind of AWS service you use? Simple EC2? Which image? Did you try to run as root?



  • If I hit F5 it runs as a standard console app on my machine.
    Did u forget some files, maybe ? I can't find no docker-compose.yml, for example



  • My apologize ... Now is the repo full.



  • So, on my Win10 Pro I installed Docker, Linux containers mode is on, a small Hyper-V VM is running ...
    I open your last repository, hit F5 but if I print in which OS is running the app I receive Windows.
    How do I know if I'm running in a container ?

    Ok, a few steps ahead:

    dotnet publish --> ok

    docker build --> ko
    Step 10/11 : COPY ${source:-obj/Docker/publish} .
    docker : COPY failed: stat /var/lib/docker/tmp/docker-builder957303330/obj/Docker/publish: no such file or directory
    At line:1 char:1

    • docker build dockernetcoretest
    •   + CategoryInfo          : NotSpecified: (COPY failed: st...le or directory:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError


  • Not sure if this is the issue. But my docker settings include the shared drive.

    0_1517484550576_upload-e6f0b628-2222-4f04-8a03-b3cd3201fcd2



  • Mine too.
    I'll inspect this issue.



  • here they recommend to clear the .dockerignore file.



  • So, if i publish explicitly in /Docker/publish the doker build process terminate correctly ?
    Now ? Where is my app ? Can I debug it on Linux ?
    Too many doubts :-)



  • This post is deleted!

Log in to reply
 

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