Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side rendering issues #56

Closed
Pix--- opened this issue Jul 19, 2021 · 12 comments
Closed

Server side rendering issues #56

Pix--- opened this issue Jul 19, 2021 · 12 comments
Labels
fixed wontfix This will not be worked on

Comments

@Pix---
Copy link

Pix--- commented Jul 19, 2021

Hello,
server side rendering is not working properly.

To Reproduce

sendTo('echarts.0', {
                preset: 'echarts.0.Tankerkoenig', // correct
                renderer: 'jpg',
                fileOnDisk: '/tmp/chart.jpg',  // Also tried full path /opt/iobroker/iobroker-data/tmp/
                fileName: 'chart.jpg'
            }, result => {
                if (result.error) {
                    log("Fehler sendTo(echarts) " + result.error, "error");
                } else {
                    log("eChart wird gesendet", "info");
                    sendTo("telegram.1", { // instance 1 is correct
                        text: "/tmp/chart.jpg"
                    }, function () {
                        log("ECharts per telegram verschickt");
                    });
                }
            });

Expected
Trying to send chart via telegram

Screenshots & Logfiles

host.ioBrokerProduktiv	2021-07-19 09:06:25.197	info	Restart adapter system.adapter.echarts.0 because enabled
host.ioBrokerProduktiv	2021-07-19 09:06:25.197	error	instance system.adapter.echarts.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
echarts.0	2021-07-19 09:06:24.548	warn	(24653) Terminated (UNCAUGHT_EXCEPTION): Without reason
echarts.0	2021-07-19 09:06:24.548	info	(24653) terminating
echarts.0	2021-07-19 09:06:24.043	error	(24653) this.socket.subscribeState is not a function
echarts.0	2021-07-19 09:06:24.043	error	at /opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:762:45
echarts.0	2021-07-19 09:06:24.043	error	(24653) TypeError: this.socket.subscribeState is not a function
echarts.0	2021-07-19 09:06:24.043	error	(24653) unhandled promise rejection: this.socket.subscribeState is not a function
echarts.0	2021-07-19 09:06:24.042	error	(24653) Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().

Versions:

  • Adapter version: 0.4.11
  • JS-Controller version: 3.2.16
  • Node version: 12.18.2
  • Operating system: Ubuntu 20.10

Thanks
Pix

@Baenker
Copy link

Baenker commented Jul 20, 2021

bekomme den gleichen Fehler.

@GermanBluefox
Copy link
Contributor

Please test 1.0.2

@Baenker
Copy link

Baenker commented Jul 20, 2021

Es kommt ein anderer Fehler. Adapter wird beendet:

host.iobroker_V51 2021-07-20 18:56:17.448 error instance system.adapter.echarts.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
echarts.0 2021-07-20 18:56:16.454 warn (648) Terminated (UNCAUGHT_EXCEPTION): Without reason
echarts.0 2021-07-20 18:56:16.453 info (648) terminating
echarts.0 2021-07-20 18:56:15.940 error (648) window is not defined
echarts.0 2021-07-20 18:56:15.940 error at listOnTimeout (internal/timers.js:554:17)
echarts.0 2021-07-20 18:56:15.940 error at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:852:39)
echarts.0 2021-07-20 18:56:15.940 error at ChartModel._readData (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:845:20)
echarts.0 2021-07-20 18:56:15.940 error at /opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:1116:22
echarts.0 2021-07-20 18:56:15.940 error at ChartModel.readTicks (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:858:13)
echarts.0 2021-07-20 18:56:15.940 error at /opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:1117:26
echarts.0 2021-07-20 18:56:15.940 error at ChartModel.readMarkings (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:940:20)
echarts.0 2021-07-20 18:56:15.940 error at /opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:1124:34
echarts.0 2021-07-20 18:56:15.940 error at ChartModel.onUpdateFunc (/opt/iobroker/node_modules/iobroker.echarts/main.js:134:33)
echarts.0 2021-07-20 18:56:15.940 error at new ChartOption (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartOption.js:334:42)
echarts.0 2021-07-20 18:56:15.940 error (648) ReferenceError: window is not defined
echarts.0 2021-07-20 18:56:15.935 error (648) uncaught exception: window is not defined

@Pix---
Copy link
Author

Pix--- commented Jul 20, 2021

Please test 1.0.2

Same error as @Baenker with v 1.0.2

host.ioBrokerProduktiv 2021-07-20 20:30:10.252 info Restart adapter system.adapter.echarts.0 because enabled
host.ioBrokerProduktiv 2021-07-20 20:30:10.251 error instance system.adapter.echarts.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
daswetter.0 2021-07-20 20:30:09.745 info (8515) starting. Version 3.0.7 in /opt/iobroker/node_modules/iobroker.daswetter, node: v12.18.2, js-controller: 3.2.16
echarts.0 2021-07-20 20:30:09.472 warn (8433) Terminated (UNCAUGHT_EXCEPTION): Without reason
echarts.0 2021-07-20 20:30:09.471 info (8433) terminating
echarts.0 2021-07-20 20:30:08.964 error (8433) window is not defined
echarts.0 2021-07-20 20:30:08.963 error (8433) ReferenceError: window is not defined at new ChartOption (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartOption.js:334:42) at ChartModel.onUpdateFunc (/opt/iobroker/node_modu
echarts.0 2021-07-20 20:30:08.962 error (8433) uncaught exception: window is not defined
`

Pix

@GermanBluefox
Copy link
Contributor

please try 1.0.3

@Pix---
Copy link
Author

Pix--- commented Jul 21, 2021

1.0.3 works fine. No more isses, log is clean.

Tank you very much, @GermanBluefox ! 🦸‍♂️

@Baenker
Copy link

Baenker commented Jul 21, 2021

wir kommen der sache näher:

host.iobroker_V51 2021-07-21 17:01:54.911 error instance system.adapter.echarts.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
echarts.0 2021-07-21 17:01:54.286 warn (7675) Terminated (UNCAUGHT_EXCEPTION): Without reason
echarts.0 2021-07-21 17:01:54.285 info (7675) terminating
echarts.0 2021-07-21 17:01:53.772 error (7675) Exception-Code: EACCES: EACCES: permission denied, open '/chart.png'
echarts.0 2021-07-21 17:01:53.772 error at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:852:39)
echarts.0 2021-07-21 17:01:53.772 error at ChartModel._readData (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:845:20)
echarts.0 2021-07-21 17:01:53.772 error at /opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:1116:22
echarts.0 2021-07-21 17:01:53.772 error at ChartModel.readTicks (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:858:13)
echarts.0 2021-07-21 17:01:53.772 error at /opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:1117:26
echarts.0 2021-07-21 17:01:53.772 error at ChartModel.readMarkings (/opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:940:20)
echarts.0 2021-07-21 17:01:53.772 error at /opt/iobroker/node_modules/iobroker.echarts/_helpers/ChartModel.js:1124:34
echarts.0 2021-07-21 17:01:53.772 error at ChartModel.onUpdateFunc (/opt/iobroker/node_modules/iobroker.echarts/main.js:202:20)
echarts.0 2021-07-21 17:01:53.772 error at Object.writeFileSync (fs.js:1384:35)
echarts.0 2021-07-21 17:01:53.772 error at Object.openSync (fs.js:462:3)
echarts.0 2021-07-21 17:01:53.772 error (7675) Error: EACCES: permission denied, open '/chart.png'
echarts.0 2021-07-21 17:01:53.767 error (7675) uncaught exception: EACCES: permission denied, open '/chart.png'

Was genau muss hier in das Script:

fileOnDisk: '/chart.png'

ich hätte jetzt gedacht mit dieser Einstellung erstellt er die Datei direkt unter iobroker-data? Mit dieser Einstellung erscheint im log die oberen Zeilen.

Wenn ich fileOnDisk: '/tmp/chart.png'
angebe ist unter dem Punkt log alles leer? Den tmp-Ordner gibt es allerdings auch nicht. Würde der Adapter den Ordner selber anlegen?

@Pix---
Copy link
Author

Pix--- commented Jul 21, 2021

Hallo @Baenker ,

mein Skript:


function echartSpritpreisTelegram () {

    // Bild an telegram schicken (immer Dienst 3)
    const dest_path = "/opt/iobroker/iobroker-data/tmp/echart/"; // Linux Pfad zum Zwischenspeichern
    let bildtext = "Spritpreise Tankerkönig als eChart";
    let filebas = "chartSpritTelegram";
    let fileext = "jpg"; // svg | png | jpg | pdf, default: svg
    function sendChart () { // Pfad zu lokalen JPG-Datei als Text an telegram übergeben
        
            sendTo('echarts.0', {
                preset: 'echarts.0.Tankerkoenig', // korrekt
                renderer: fileext,
                //background: '#000000', // schwarz
                //theme: 'light',
                title: "Tankerkönig Spritpreise",
                //quality: 0.8,
                fileOnDisk: dest_path + filebas + '.' + fileext
            }, result => {
                if (result.error) {
                    log("Fehler sendTo(echarts) " + result.error, "error");
                } else {
                    log("eChart wird gesendet", "info");
                    sendTo(telegram, {
                        text: dest_path + filebas + '.' + fileext, 
                        caption: bildtext,
                        disable_notification: true
                    }, function () {
                        log(bildtext + " per telegram verschickt");
                    });
                }
            });
    }

    sendChart(); // EChart senden durchgehen

}
echartSpritpreisTelegram ();

Die Bild-Datei wird in meinem Falle im Ordner <IP-IOBROKER>/opt/iobroker/iobroker-data/tmp/echart/ gespeichert und dann versendet. Evtl. muss man den Ordner /tmp/echart manuell anlegen.

Gruß
Pix

@Baenker
Copy link

Baenker commented Jul 21, 2021

@pix Vielen Dank. Kannst das Issue zu machen. Bei mir funktioniert das erstellen der Datei nun auch:

/opt/iobroker/iobroker-data/tmp/chart.jpg"

Mit Pushover zu verschicken funktioniert dann auch

Wird die Datei immer wieder überschrieben wenn ich das Script neu läuft oder wie kann ich es per Script löschen?

@Baenker
Copy link

Baenker commented Jul 21, 2021

Datei wird überschrieben hat mein Test ergeben. Dann werde ich das jetzt mal in das ein oder andere Script einbauen.

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions.
Dieses Problem wurde automatisch als veraltet markiert, da es in letzter Zeit keine Aktivitäten gab. Es wird geschlossen, wenn nicht innerhalb der nächsten 7 Tage weitere Aktivitäten stattfinden. Bitte überprüft, ob das Problem auch in der aktuellsten Version des Adapters noch relevant ist, und teilt uns dies mit. Überprüft auch, ob alle relevanten Details, Logs und Reproduktionsschritte enthalten sind bzw. aktualisiert diese. Vielen Dank für Eure Unterstützung.

@stale stale bot added the wontfix This will not be worked on label Apr 16, 2022
@stale
Copy link

stale bot commented Apr 27, 2022

This issue has been automatically closed because of inactivity. Please open a new issue if still relevant and make sure to include all relevant details, logs and reproduction steps. Thank you for your contributions.
Dieses Problem wurde aufgrund von Inaktivität automatisch geschlossen. Bitte öffnet ein neues Issue, falls dies noch relevant ist und stellt sicher das alle relevanten Details, Logs und Reproduktionsschritte enthalten sind. Vielen Dank für Eure Unterstützung.

@stale stale bot closed this as completed Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants