Azure Web App - Docker custom image error
-
We decided to use JSreport as Utility in a Net Core web API project, where we have a call that renders a PDF using JSreport, so we follow all the documentation to generate the Dockerfile accordingly and perform the deployment using Azure Devops as well, when we mount the Docker Image locally in a mac it runs properly, the PDF is generated without any errors, however, in Azure we are not being able to generate the PDF, using ssh in azure we are getting the following error:
**** RenderAsync by ShortID - BaseException: Value does not fall within the expected range. Services.LoggerManager - at System.Collections.Specialized.StringDictionaryWrapper.Add(String key, String value) at jsreport.Local.Internal.BinaryProcess.InnerExecute(String cmd, Boolean waitForExit) at jsreport.Local.Internal.BinaryProcess.ExecuteExe(String cmd, Boolean waitForExit) at jsreport.Local.Internal.LocalUtilityReportingService.RenderAsync(String requestString, CancellationToken ct) at OurProject.Services.Services.IllustrationPdfService.GetJSReportByShortId(IllustrationDTO illustrationDTO)
Do you have any clue what could be our problem?
this is how we create the Report service in our startup class, but we are not able to create a basic report even creating a very basic template like the local Get started code example,
services.AddJsReport(new LocalReporting() .UseBinary(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? jsreport.Binary.JsReportBinary.GetBinary() : jsreport.Binary.Linux.JsReportBinary.GetBinary() ) .KillRunningJsReportProcesses() .RunInDirectory(currentDirectory) .Configure(cfg => { cfg.HttpPort = 1000; cfg.AllowedLocalFilesAccess(); cfg.Extensions = new ExtensionsConfiguration() { Scripts = new ScriptsConfiguration() { AllowedModules = "*" }, }; cfg.FileSystemStore(); cfg.CreateSamples(); cfg.BaseUrlAsWorkingDirectory(); cfg.TemplatingEngines = new TemplatingEnginesConfiguration() { AllowedModules = "*" }; return cfg; }) .AsUtility() .Create());
we appreciate any comment or idea you can have to solve this,
thank you!!
-
Sorry for your troubles.
It seems your app gets some environment variables that have the same keys as jsreport uses in the configuration.
We were duplicating these when running jsreport binary and that caused the mentioned error.It is now fixed and we don't add the env variables if already present. You can get the change in jsreport.Local@2.1.1
-
Wow that was fast!! :)
thanks a lot for that fix mate, we have this up and running now!
looking forward to continue working with this great tool!cheers!