jsreport / jsreport-dotnet

jsreport .NET sdk home repository
https://jsreport.net
MIT License
63 stars 9 forks source link

30000ms Timeout when attempting to generate PDF in DotNetCore / dotnet 6 #63

Closed gregpawlowski closed 2 years ago

gregpawlowski commented 2 years ago

I'm unable to generate a successfull report using very simple HTML.

The Following packages are installed: jsreport.aspnetcore\2.1.0\ jsreport.binary\2.11.0\ jsreport.local\2.3.1\

Code I have the following code in an ApiController

  var rs = new LocalReporting()
  .Configure(cfg => cfg.AllowedLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory())
  .UseBinary(JsReportBinary.GetBinary())
  .KillRunningJsReportProcesses()
  .AsUtility()
  .Create();

  var generatedPdf = await rs.RenderAsync(new RenderRequest
  {
      Template = new Template
      {
          Recipe = Recipe.ChromePdf,
          Engine = Engine.None,
          Content = "<H1>Test</H1>",
          Chrome = new Chrome
          {
              MarginTop = "10",
              MarginBottom = "10",
              MarginLeft = "50",
              MarginRight = "50"
          }
      }
  });

  return File(generatedPdf.Content, generatedPdf.Meta.ContentType, "SomeFileName.pdf");

The Full Error I'm Getting: Error rendering report: instance has been daemonized and initialized successfully (pid: 27748)rendering has finished with errors:A critical error occurred while trying to execute the render command (2). waiting for target failed: timeout 30000ms exceeded (1). caused by error (2):-> stackError: at onCriticalError (D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:302:19) at D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:256:14 at processTicksAndRejections (internal/process/task_queues.js:97:5)caused by error (1):-> stackError: at Client.render (D:\snapshot\jsreport\node_modules\jsreport-client\lib\client.js) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async startRender (D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:319:24) at async D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:226:22 at async Commander.executeCommand (D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commander.js:242:22)Remote stack: TimeoutError: at Function.waitWithTimeout (D:\snapshot\jsreport\node_modules\puppeteer\lib\helper.js:228:26) at Browser.waitForTarget (D:\snapshot\jsreport\node_modules\puppeteer\lib\Browser.js:214:27) at Browser. (D:\snapshot\jsreport\node_modules\puppeteer\lib\helper.js:112:23) at Launcher.launch (D:\snapshot\jsreport\node_modules\puppeteer\lib\Launcher.js:184:21) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async getBrowser (D:\snapshot\jsreport\node_modules\jsreport-chrome-pdf\lib\dedicatedProcessStrategy.js:13:21) at async D:\snapshot\jsreport\node_modules\jsreport-chrome-pdf\lib\conversion.js:4:19 at async execute (D:\snapshot\jsreport\node_modules\jsreport-chrome-pdf\lib\dedicatedProcessStrategy.js:10:22) at async Object.execute (D:\snapshot\jsreport\node_modules\jsreport-chrome-pdf\lib\chrome.js:68:20) at async D:\snapshot\jsreport\node_modules\jsreport-core\lib\render\render.js:150:5

pofider commented 2 years ago

Could you try to remove the following and try again? c:\Users\usrXXX\AppData\Local\Temp\jsreport\

I've tried .net 6 with this example repo and it works properly. https://github.com/jsreport/jsreport-dotnet-example-consoleapp

pofider commented 2 years ago

I've released jsreport.Binary 3.8.0 as well as the other .net sdk nugets. Please try it out and reopen the issue if you have further issues.