node-export-server icon indicating copy to clipboard operation
node-export-server copied to clipboard

Stop creation of log and tmp folder

Open bhavya0901 opened this issue 1 year ago • 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 ?

bhavya0901 avatar Mar 27 '24 05:03 bhavya0901

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.

jszuminski avatar Mar 28 '24 11:03 jszuminski

Thank you for answering my question @jszuminski

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

bhavya0901 avatar Mar 29 '24 08:03 bhavya0901

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 ?

bhavya0901 avatar Apr 15 '24 05:04 bhavya0901

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.

jszuminski avatar May 16 '24 10:05 jszuminski

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.

bhavya0901 avatar May 16 '24 13:05 bhavya0901

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.

mikemeerschaert avatar May 28 '24 18:05 mikemeerschaert

Hi @jszuminski , Any update on this enhancement?

bhavya0901 avatar Jul 01 '24 08:07 bhavya0901

Hi @jszuminski , Any update on this enhancement?

bhavya0901 avatar Jul 15 '24 13:07 bhavya0901

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

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

nhitchins avatar Jul 23 '24 23:07 nhitchins

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

DanielRuf avatar Aug 26 '24 09:08 DanielRuf