TheFlyingNose
TheFlyingNose

Reputation: 1

Uncaught TypeError: Cannot read properties of null (reading 'removeChild') on production deployment with cloudflare

I get the error in the title when on production deployment with cloudflare enabled, but not on a staging environment without cloudflare and not locally. I don't know for certain it is cloudflare causing it, but it appears to be the only difference. Does anyone have any ideas what could be causing this?

<div class="modal">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-body" id="modalBody">
      </div>
    </div>
  </div>
</div>

<script>
  async function OpenPaymentsModal(IsPayment, CoinTypeId, IsEdit) {
    await fetch("/Controller/_Modal", {
      method: "post",
      body: form,
    })
      .then((resp) => resp.text())
      .then((text) => {
        $("#modalBody").html(text); //Error Here
      })
      .catch((err) => {});
  }
</script>

I have tried turning off cloudflare rocket loader on this page, no change in behaviour. One thing to note is on the partial that is loaded from the fetch it uses selectize dropdowns.

Upvotes: 0

Views: 38

Answers (0)

Related Questions