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.

    axios request returns no data, while http request does

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 5 Posters 2.9k Views 5 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.
    • ? Offline
      A Former User
      last edited by

      Hi,

      Sometime something like this with https can help:

      const httpsAgentConfig = { rejectUnauthorized: false }
      this.axiosInstance = axios.create({
        httpsAgent: new https.Agent(httpsAgentConfig),
      })
      

      after adapt it with your code
      try it, no guaranties… but maybe …

      1 Reply Last reply Reply Quote 0
      • A Offline
        ASh
        last edited by

        Did you ever find out the answer to this, i’m having the same issue.

        1 Reply Last reply Reply Quote 0
        • lavolp3L Offline
          lavolp3 Module Developer
          last edited by

          No unfortunately not.
          Above addition did not help.

          I’m getting the feeling that the axios requests somehow closes before the data field is being returned. Haven’t tried much since it is not highest priority for me. But would appreciate any idea/suggestion.

          How to troubleshoot modules
          MMM-soccer v2, MMM-AVStock

          1 Reply Last reply Reply Quote 0
          • S Offline
            sharklaser
            last edited by

            for some reason it doesn’t seem to like the axios user agent. Changing it to something else appears to work. Example:

            axios.defaults.headers.common['User-Agent'] = 'PostmanRuntime/7.26.2';
            
            S lavolp3L 2 Replies Last reply Reply Quote 1
            • S Do not disturb
              sdetweil @sharklaser
              last edited by

              @sharklaser many servers use the user-agent string to generate different content , as the ‘browsers’ all support different things, so a random string as user-agent will fail

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • lavolp3L Offline
                lavolp3 Module Developer @sharklaser
                last edited by

                @sharklaser said in axios request returns no data, while http request does:

                :
                axios.defaults.headers.common[‘User-Agent’] = ‘PostmanRuntime/7.26.2’;

                That was the solution! Thanks!!

                How to troubleshoot modules
                MMM-soccer v2, MMM-AVStock

                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