Skip to content

ReferenceError: Element is not defined: SSR breaks when using solid-transition-group on cloudflare workers #33

@Odas0R

Description

@Odas0R

Here's the reproduction url:

https://github.com/Odas0R/solid-group-transition-bug

Everything you need to do is on the URL to throw the error. I'm using wrangler cli which emulates a worker environment. Code also breaks in production.

This is the code that breaks:

import { createSignal } from "solid-js"
import { Transition } from "solid-transition-group"

export const SolidTransition = () => {
  const [isOpen, setOpen] = createSignal(false)

  return (
    <div>
      <Transition>{isOpen() && <div>hello</div>}</Transition>
    </div>
  )
}

On the astro page:

---
import Layout from '../../layouts/Layout.astro';
import { SolidTransition } from '../../components/SolidTransition.tsx';

export const prerender = false;
---

<Layout title="Welcome to Astro.">
	<main>
		<h1>SSR</h1>
		<SolidTransition client:load />
	</main>
</Layout>

The error:

[mf:wrn] Service bindings are experimental. There may be breaking changes in the future.
[mf:inf] Worker reloaded! (171.47KiB)
[mf:inf] Listening on 0.0.0.0:3000
[mf:inf] - http://127.0.0.1:3000
[mf:inf] - http://192.168.31.106:3000
[mf:inf] - http://172.17.0.1:3000
[mf:inf] Updated `Request.cf` object cache!
GET /preview/lol 404 Not Found (6.99ms)
[mf:err] GET /ssr: ReferenceError: Element is not defined
    at Ui (/tmp/astro-test/wow/dist/_worker.js:60:23785)
    at tn (/tmp/astro-test/wow/dist/_worker.js:60:23813)
    at Object.fn (/tmp/astro-test/wow/dist/_worker.js:60:24004)
    at Bi (/tmp/astro-test/wow/dist/_worker.js:60:19150)
    at Te (/tmp/astro-test/wow/dist/_worker.js:60:18936)
    at Z (/tmp/astro-test/wow/dist/_worker.js:60:17075)
    at qi (/tmp/astro-test/wow/dist/_worker.js:60:23998)
    at Wi (/tmp/astro-test/wow/dist/_worker.js:60:25730)
    at an (/tmp/astro-test/wow/dist/_worker.js:60:26836)
    at ra (/tmp/astro-test/wow/dist/_worker.js:71:164)
GET /ssr 200 OK (173.41ms)
GET /_astro/index.12c5fa68.css 304 Not Modified (5.66ms)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions