MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Node-helper Access-Control-Allow-Origin

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    6 Posts 2 Posters 837 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      fischi87
      last edited by fischi87

      Hello, I get always this error “CORS-Kopfzeile ‘Access-Control-Allow-Origin’ fehlt)”

      how is it possible the manage the node-helper.js to solved this error?

      the node-helper.js:

      const NodeHelper = require("node_helper");
      const https = require("https");
      const express = require("express");
      const app = express();
      const cors = require('cors');
      
      module.exports = NodeHelper.create({
        start: function () {
          console.log("MMM-Cryptocurrency loaded!");
        },
      
        socketNotificationReceived: function (notification, payload) {
          if (notification === "get_ticker") {
            this.getTickers(payload);
          }
        },
      
        getTickers: function (payload) {
          var self = this;
          https
            .get(payload.url, (res) => {
              let data = "";
              res.on("data", (chunk) => {
                data = data + chunk.toString();
              });
              res.on("end", () => {
                self.sendSocketNotification("got_result", { id: payload.id, data: JSON.parse(data) });
              });
            })
            .on("error", (err) => {
              console.log("MMM-Cryptocurrency error: ", err.message);
            });
        }
      });
      
      

      thanks guys

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @fischi87
        last edited by

        @fischi87 there is a new mm service to help get around this coming in next release.

        it’s in the develop branch now.

        see this on how to get develop

        https://forum.magicmirror.builders/topic/14327/testing-new-fixes-or-solving-current-problems-with-next-release-code

        see here for the new feature
        https://github.com/MichMich/MagicMirror/issues/2714#issuecomment-1024627426

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        F 1 Reply Last reply Reply Quote 0
        • F Offline
          fischi87 @sdetweil
          last edited by

          @sdetweil

          this post ist more than 1 Jahr ago !

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @fischi87
            last edited by

            @fischi87 so? same instructions work today. I don’t have to type them again

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            F 1 Reply Last reply Reply Quote 0
            • F Offline
              fischi87 @sdetweil
              last edited by

              @sdetweil

              ist still dosent work, a other idea? how is it possible to write it in this node_helper.js?

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @fischi87
                last edited by

                @fischi87 yes, but I don’t know how

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Sam, technical setup by Karsten.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy