Uncaught ReferenceError: HTMLElement is not defined

I am trying to do Server Side Rendering using import {render} from '@lit-labs/ssr'; and import {html} from 'lit';

I am doing this by importing the libraries inside the /functions folder. But I get the error below.

✘ [ERROR] service core:user:start-project: Uncaught ReferenceError: HTMLElement is not defined

    at null.<anonymous> (functionsWorker-0.2806522561602802.js:152:9)


✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.`

What cloud be the problem?