project-lovelace / lovelace-website

📜 Back end and front end code for the Project Lovelace website.
http://projectlovelace.net
MIT License
29 stars 4 forks source link

TypeError: Cannot read property 'addEventListener' of null #143

Open ksamuel opened 3 years ago

ksamuel commented 3 years ago

When submitting a solutino to https://projectlovelace.net/problems/habitable-exoplanets/, the spinner is stuck forever, and the console displays the error "TypeError: Cannot read property 'addEventListener' of null". The debugger points to this part of the code, where dropdown contains null:

  <script>
    var dropdown = document.querySelector('.dropdown');
    dropdown.addEventListener('click', function(event) {
      event.stopPropagation();
      dropdown.classList.toggle('is-active');
    });
  </script>

Indeed, I can't find any node with the ".dropdown" class.

Firefox 87.0 in Ubuntu 21.04 but I get the same error in Chromium.

Vismai-Khanderao commented 3 years ago

Looks like the TypeError is on other problems too and appears in the console before any code is submitted even.

It also looks like the stuck spinner is caused due to a 500 error possibly as another error pops up in the console

image

And surely enough the response it's trying to parse is an html template with the title HTTP 500 Internal server error | Project Lovelace

We'll need to work on a fix for that