highcharts/node-export-server

Stop creation of log and tmp folder

bhavya0901 opened this issue · 10 comments

Actual behaviour
highcharts-export-server create log and tmp folder during chart image download process but kubernetes does not allow to create a folder like this.

Expected behaviour
chart image will download without creation log and tmp folder.

I think after adding options.logging.level = 0 log folder not created, same as log folder which code require to stop creation of tmp folder

const exportSettings = {
          export: {
            type: "png",
            options: report_config.data,
          },
        };
        
        const options = exporter.setOptions(exportSettings);
        options.logging.level = 0 // to remove log folder when image download
        await exporter.initPool(options);
        
        exporter.startExport(exportSettings, async function (res, err) {
          if (err) {
            log.info("Error in exporting chart : " + err); // error comes from here when code deployed on live server
            return resp.status(500).send({ msg: err.message });
          }
          log.info("buffer data getting")
          const binaryData = Buffer.from(res.data, "base64");
          exporter.killPool();

I've write above code to get chart image and it's perfectly working fine in my local but I'm getting In pool.postWork: [pool] Error when acquiring available entry: Error when code deployed on live server

I think tmp folder doesn't created on live server and due to this reason I'm getting this error may be Kubernetes does not allow to create tmp folder on live server

Do you have any solution to resolve this issue ?

Thanks for reporting @bhavya0901!

Puppeteer requires a directory like /tmp. After all the prioritized issues related to server health are fixed, we will consider adding an option which would allow you to change that directory.

In the meantime, if possible, adjust your Kubernetes deployment to allow the creation of temporary folders. This might involve modifying security policies or the filesystem to permit such actions. This approach is pretty straightforward and acts as a good workaround.

Thank you for answering my question @jszuminski

Hope soon you will adding an option which would allow us to change tmp directory.

Thanks for reporting @bhavya0901!

Puppeteer requires a directory like /tmp. After all the prioritized issues related to server health are fixed, we will consider adding an option which would allow you to change that directory.

In the meantime, if possible, adjust your Kubernetes deployment to allow the creation of temporary folders. This might involve modifying security policies or the filesystem to permit such actions. This approach is pretty straightforward and acts as a good workaround.

Hi @jszuminski
Have you added option which would allow us to change that directory ? Is any update on it ?

Hi @bhavya0901, we have not yet added this option. We're currently working on improving the performance and health of the Export Server before the next release (which is going to be a major change). We will get back to your feature request once all the prioritized issues are solved (upcoming months).

I will keep you posted.

Hi @jszuminski

Thank you for the update. I understand that improving the performance and health of the Export Server is a priority right now. I appreciate your diligence in addressing these issues first. Looking forward to hearing back about the feature request once the current priorities are resolved.

In the meantime, if possible, adjust your Kubernetes deployment to allow the creation of temporary folders. This might involve modifying security policies or the filesystem to permit such actions. This approach is pretty straightforward and acts as a good workaround.

This is unfortunately not an option with AWS Lambda so the Highcharts export server is incompatible with lambda until the ability to change the temp folder location has been added.

Hi @jszuminski ,
Any update on this enhancement?

Hi @jszuminski ,
Any update on this enhancement?

@bhavya0901 You can specify the tmp directory using puppeteer args in export settings

"puppeteer": { "args": ["--user-data-dir=./new-puppeteer-tmp-path"] },

Waiting for a path setting which is for logs and tmp folder.