Cannot load image asset



  • I have been running JS Report via a docker container on Azure, but have now migrated onto a VM and installed JSReport as a Windows service.

    I am getting the following error when running a report which loads dynamic headers and footers.

    Error when processing render request 2 Asset ./data/images/ntv/logo.png not found in the store and also not on the disk: Unable to find or read file C:\jsreportapp\data\images\ntv\logo.png. EISDIR: illegal operation on a directory, read Error: Asset ./data/images/ntv/logo.png not found in the store and also not on the disk: Unable to find or read file C:\jsreportapp\data\images\ntv\logo.png. EISDIR: illegal operation on a directory, read

    The code was working in docker/Azure but now will not see the image files.

    I call the asset in my code like this:

    <div><img class="h-16 p-3" src="{#asset {{getLogo @root.data.reportDetails.templatePath}} @encoding=dataURI}"/></div>

    Which calls a function as follows:

    function getLogo(templatePath) {
    return './data/images/' + templatePath.toLowerCase() + '/logo.png'
    }

    Please help me understand why it is no longer executing correctly?

    Thanks



  • It seems the logo.png is a directory based on the error.
    This would mean it's actually an asset entity.
    The path should look like ./images/ntv/logo.png then. Without the ./data prefix.



  • Hi Jan

    Thanks for the reply. Unfortunately, that didn't work. I get the same error:

    Error: Error while executing pdf-utils operations. Asset ./images/ntv/logo.png not found in the store and also not on the disk: Unable to find or read file C:\jsreportapp\images\ntv\logo.png. ENOENT: no such file or directory, open 'C:\jsreportapp\images\ntv\logo.png'

    I have tried many combinations of path, but can't seem to get it to load the image.



  • Is it an asset or a just file log.png on the disk? Do you see it in the studio?
    What jsreport version do you use?



  • I am using version: 2.11.0

    It's an asset that I dynamically load on the header along with some footer text.

    When I click on the image in the studio, it loads fine.

    This is what it looks like in the studio folder structure:
    0_1645549902064_Capture.PNG



  • Strange...
    Is it possible for you to email me the entities export confidentially?



  • OK, I have sent it to you.


Log in to reply
 

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