Search Unity

'XMLHttpRequest': The object's state must be OPENED.

Discussion in 'Web' started by Shadowing, Mar 30, 2021.

  1. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Just upgraded from 2018 LTS to 2019 LTS and I'm seeing this error a ton in my game. My game uses a ton of web calls.
    For what i read online on javascript forums this seems like a game engine bug

    'XMLHttpRequest': The object's state must be OPENED."
     
  2. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    This issue exists in 2020 too. Might be due to me using the asset BESTHTTP though.
     
  3. kevin_circadence

    kevin_circadence

    Joined:
    Dec 4, 2018
    Posts:
    3
    Did you ever get this resolved? We also started seeing this recently after our update from 2019 to 2020, and we also use BestHTTP in our project. I've reached out the their support about it, but they seemed convinced it was a problem with Unity.
     
  4. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Ya i don't have this issue anymore. Think it went away on its own. I just tested web gl again and that error is not there. I remember it was spamming the hell out of console log too in chrome.

    I'm on Unity 2020.3.11 now
    which version of 2020 you using?
     
  5. kevin_circadence

    kevin_circadence

    Joined:
    Dec 4, 2018
    Posts:
    3
    We're actually using 2021.1.9f1 and the "state must be OPENED" error shows in the chrome console every time we send a web request. Firefox shows a slightly different error: "InvalidStateError: XMLHttpRequest must not be sending."

    I was able to hack a couple changes into the BestHTTP_WebRequest.jslib file to prevent the error messages, though I don't think what I did was appropriate/release-worthy.
     
  6. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Ya i remember now it did it every time a request was sent for me as well. hmm.
    I don't think it actually effects anything?
     
  7. kevin_circadence

    kevin_circadence

    Joined:
    Dec 4, 2018
    Posts:
    3
    correct, the error seems to be superficial... our requests get through to our server correctly, data is logged, and we get a 202 response; though the errors continue to show in the browser console.
     
  8. sahagk

    sahagk

    Joined:
    Apr 16, 2023
    Posts:
    1
    it's beacose of you are setting headers before open() function