Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Error in callback: TypeError: axios is not a function

    NEWS

    • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?

    • Monatsrückblick – September 2025

    • Neues Video "KI im Smart Home" - ioBroker plus n8n

    Error in callback: TypeError: axios is not a function

    This topic has been deleted. Only users with topic management privileges can see it.
    • cash
      cash Most Active last edited by

      Nach dem Update vom JavaScript Adapter habe ich auf einmal Fehler bei Scripten wo ich axios nutze. Was muss ich ändern damit es wieder läuft?

      Hier ein Teil vom Script welches das Problem ist. Variablen wie z. B. pushover_acknowledged ist weiter oben im Script deklariert.

      
      //Pushover muss bestätigt werden
                  if(pushover_acknowledged){
                      pushover_acknowledged = false;
                      const axios = require('axios');
                      var URL = 'https://api.pushover.net/1/receipts/cancel_by_tag/'+pushover_tag +'.json';         
                                  
                      axios({
                          method: 'post',
                          url: URL,
                          //headers: {'Content-Type':'application/x-www-form-urlencoded'} ,  
                          data: {
                              "token": 'xxxx'
                              },
                          timeout: 4500,
                          responseType: 'json'
                      })
                      .then((response) => {
                          if(debugging){
                              log('data:' +JSON.stringify(response.data));
                              log('Status: ' +response.status);
                              //log('Header:' +response.headers);
                          }
                          if(response.status = 200){
                              //Umwandeln in String
                              var data_string = JSON.stringify(response.data)
                              var data_split_1= data_string.split(",");
                              var data_split_2= data_split_1[1].split(":");
                              var _result = parseInt(data_split_2[1],10);
                              
                              if(_result > 0){
                                  log('Pushnachricht wurde automatisch bestätigt. --- Anzahl bestätigter Nachrichten: '+_result );
                              }
                              else{
                                  log('Pushnachricht konnte nicht bestätigt werden.' +data_string)
                              }
                          }
                          else{
                              if(logging){
                                  log('Es gibt ein Problem: ' +response.status,'warn');
                              }
                          } 
      
                      })
                      .catch(
                          (error) => {
                              // handle error
                              log('Es gibt einen Fehler: ' +error,'warn');           
                          }
                      );
      
      
      Ro75 Asgothian 2 Replies Last reply Reply Quote 0
      • Ro75
        Ro75 @cash last edited by

        @cash ist axios als zusätzliches NPM Paket im JS Adapter eingetragen?

        Ro75.

        cash 1 Reply Last reply Reply Quote 0
        • Asgothian
          Asgothian Developer @cash last edited by Asgothian

          @cash sagte in Error in callback: TypeError: axios is not a function:

          Nach dem Update vom JavaScript Adapter habe ich auf einmal Fehler bei Scripten wo ich axios nutze. Was muss ich ändern damit es wieder läuft?

          Hier ein Teil vom Script welches das Problem ist. Variablen wie z. B. pushover_acknowledged ist weiter oben im Script deklariert.

          
          //Pushover muss bestätigt werden
                      if(pushover_acknowledged){
                          pushover_acknowledged = false;
                          const axios = require('axios');
                          var URL = 'https://api.pushover.net/1/receipts/cancel_by_tag/'+pushover_tag +'.json';         
                                      
                          axios({
                              method: 'post',
          [...snip]
          
          

          Hmm.. nach der Axios doku kann das so eigentlich nicht gelaufen sein. Hast du da am Skript was getan (request gegen Axios getauscht ? )

          Unsinn - ich hab an der falschen Stelle geschaut.

          A.

          1 Reply Last reply Reply Quote 0
          • cash
            cash Most Active @Ro75 last edited by

            @ro75 ja habe ich.

            @Asgothian Das lieft vermutlich seit dem 04.02.21 wenn meine Dokumentation halbwegs stimmt. Letzte Änderung am Script am 22.04.24

            1 Reply Last reply Reply Quote 0
            • cash
              cash Most Active last edited by

              Hat hier niemand eine Idee?

              Ro75 1 Reply Last reply Reply Quote 0
              • Ro75
                Ro75 @cash last edited by

                @cash ok, welche Version vom JS Adapter läuft? Admin-Adapter? Welche js-controler Version? Welches NodeJS?

                Welches OS läuft mit welchem Stand?

                Ro75.

                cash 1 Reply Last reply Reply Quote 0
                • cash
                  cash Most Active @Ro75 last edited by

                  @ro75 Admi 7.7.19
                  JavaScript 9.0.11
                  js7.06

                  Node.js: v18.20.2 (ja ist nicht so richtig frisch). Läuft auf einen Synology.
                  Problem besteht seit Update JavaScript Adapter. Welche Version ist vorher hatte kann ich nicht mehr genau sagen. Es sind glaube ich ein paar Versionen gewesen

                  Ro75 Thomas Braun 2 Replies Last reply Reply Quote 0
                  • Ro75
                    Ro75 @cash last edited by

                    @cash sagte in Error in callback: TypeError: axios is not a function:

                    JavaScript 9.0.11

                    das ist wohl BETA. Letzter Stable Stand 8.9.2. Gehe mal wieder zurück.

                    Ro75.

                    cash 1 Reply Last reply Reply Quote 0
                    • Thomas Braun
                      Thomas Braun Most Active @cash last edited by

                      @cash sagte in Error in callback: TypeError: axios is not a function:

                      Node.js: v18.20.2 (ja ist nicht so richtig frisch).

                      Das ist sogar ziemlich TOT. Brings wieder in's Reich der Lebenden.

                      1 Reply Last reply Reply Quote 0
                      • cash
                        cash Most Active @Ro75 last edited by

                        @ro75 Bin wieder zurück auf die Stable mal schauen ob es dann wieder läuft. Werde ich dann morgen sehen wenn ich lüfte…

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        996
                        Online

                        32.4k
                        Users

                        81.3k
                        Topics

                        1.3m
                        Posts

                        4
                        10
                        67
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo