You are calling a variable response that does not exist
Replace line .then(res => response.text()) with .then(res => res.text())
If you had a catch statement before doing my recommended change, you will see the error (see below sample code). You current code had an error but silently fails as you didn't catch it...
// Load kml file
An old question, but none of the supplied answers appear to fix it. Is your GDAL built with the Expat XML Parser? I see the GDAL docs say that KML read is only supported if GDAL/OGR was built with Expat KML Parser.
Otherwise, only KML Write is supported.