• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Testing my module, it is stuck loading

Scheduled Pinned Locked Moved Solved Troubleshooting
31 Posts 2 Posters 7.1k 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.
  • L Offline
    l0zarus @sdetweil
    last edited by May 8, 2023, 1:45 AM

    @sdetweil I’m struggling to understand the first part. I don’t think there is any header stuff that I know of? the url is based on this format: https://api.seatgeek.com/2/events?client_id=MYCLIENTID&client_secret=MYCLIENTSECRET with other stuff added as you saw in my source code in the original post.

    honestly the whole thing is a bit confusing to me. I’m not sure where it is supposed to go… as part of where I define the URL variable?

    S 1 Reply Last reply May 8, 2023, 1:46 AM Reply Quote 0
    • S Offline
      sdetweil @l0zarus
      last edited by sdetweil May 8, 2023, 1:48 AM May 8, 2023, 1:46 AM

      @l0zarus ok, no headers set it to “”

      you use that code to build your fetch url (and put it in the original_url variable)

      I just created the JS code to do the build from the parts
      the comment in the linked file just doesn’t help me at all…

      and when you execute the fetch, it sends it to magic mirror code that forwards on supposedly to avoid the cors problem…

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      L 1 Reply Last reply May 8, 2023, 1:52 AM Reply Quote 0
      • L Offline
        l0zarus @sdetweil
        last edited by sdetweil May 8, 2023, 1:55 AM May 8, 2023, 1:52 AM

        @sdetweil I’m going to try to fill it out like a template, let me know if I’m following.

        let header = "",
        
        let original_url = "https://api.seatgeek.com/2/events?client_id=MYCLIENTID&client_secret=MYCLIENTSECRET "
        
        let cors_url = "http://" + config.address==="IP ADDRESS HERE"?"localhost":config.address + ":" + config.port + "/cors?" + header + "&url=" + original_url
        

        and then I fetch(cors_url)?

        Is this right?

        S 1 Reply Last reply May 8, 2023, 1:53 AM Reply Quote 0
        • S Offline
          sdetweil @l0zarus
          last edited by sdetweil May 8, 2023, 1:56 AM May 8, 2023, 1:53 AM

          @l0zarus said in Testing my module, it is stuck loading:

          Is this right?

          yes

          almost …

          "IP ADDRESS HERE"
          

          MUST be

          "0.0.0.0" 
          

          (which is the MM value for listen on any network adapter)

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          L 1 Reply Last reply May 8, 2023, 2:01 AM Reply Quote 0
          • L Offline
            l0zarus @sdetweil
            last edited by May 8, 2023, 2:01 AM

            @sdetweil

                ```
            

            // this next block is to deal with a CORS permissions issue with the API
            let header = “”;

                // this is the API call url
                let original_url = "http://api.seatgeek.com/2/events?lat=" + self.config.latitude + "&lon=" + self.config.longitude + "&per_page=" + self.config.eventCount + "&datetime_utc.gte=" + today + "&datetime_utc.lte=" + oneweek + "&range=" + self.config.range + "&type=concert" + "&client_id=" + self.config.clientID + "&client_secret=" + self.config.clientSecret;
                
                // this is the cors URL
                let cors_url = "http://" + config.address==="0.0.0.0"?"localhost":config.address + ":" + config.port + "/cors?" + header + "&url=" + original_url;
            
            S 1 Reply Last reply May 8, 2023, 2:03 AM Reply Quote 0
            • S Offline
              sdetweil @l0zarus
              last edited by May 8, 2023, 2:03 AM

              @l0zarus looks good

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              L 1 Reply Last reply May 8, 2023, 2:07 AM Reply Quote 0
              • L Offline
                l0zarus @sdetweil
                last edited by May 8, 2023, 2:07 AM

                @sdetweil I got a new console error:

                Screenshot 2023-05-07 at 10.06.40 PM.png

                S 1 Reply Last reply May 8, 2023, 2:12 AM Reply Quote 1
                • S Offline
                  sdetweil @l0zarus
                  last edited by sdetweil May 8, 2023, 2:13 AM May 8, 2023, 2:12 AM

                  @l0zarus you did NOT add let config= right? (or var, or const)

                  config is already defined for you

                  this.config is the stuff from your module entry
                  config. is ALL the config.js

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  L 2 Replies Last reply May 8, 2023, 2:15 AM Reply Quote 0
                  • L Offline
                    l0zarus @sdetweil
                    last edited by May 8, 2023, 2:15 AM

                    @sdetweil

                    I added let header = “” and let cors_url = jdhflrkgd. I did not add anything else at all.

                    exact code below:

                            let header = "";
                    
                            // this is the API call url
                            let original_url = "http://api.seatgeek.com/2/events?lat=" + self.config.latitude + "&lon=" + self.config.longitude + "&per_page=" + self.config.eventCount + "&datetime_utc.gte=" + today + "&datetime_utc.lte=" + oneweek + "&range=" + self.config.range + "&type=concert" + "&client_id=" + self.config.clientID + "&client_secret=" + self.config.clientSecret;
                            
                            // this is the cors URL
                            let cors_url = "http://" + config.address==="0.0.0.0"?"localhost":config.address + ":" + config.port + "/cors?" + header + "&url=" + original_url;
                        
                            // fetching the data from seatgeek
                            fetch(cors_url)
                    
                    S 1 Reply Last reply May 8, 2023, 2:22 AM Reply Quote 1
                    • L Offline
                      l0zarus @sdetweil
                      last edited by May 8, 2023, 2:17 AM

                      @sdetweil

                      strange… I just found the following code at the top of my file. I did not add it there. Going to delete it now.

                      const config = require("../../config/config");
                      
                      1 Reply Last reply Reply Quote 1
                      • 1
                      • 2
                      • 3
                      • 4
                      • 2 / 4
                      2 / 4
                      • First post
                        23/31
                        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