lustre-labs / lustre

An Elm-inspired framework for building HTML templates, single page applications, and server-rendered components in Gleam!
https://hexdocs.pm/lustre
MIT License
744 stars 53 forks source link

http server crashes when running ui demo with node #35

Closed wezm closed 5 months ago

wezm commented 5 months ago

Error:

gleam run -m lustre/try --target javascript
   Compiled in 0.01s
    Running lustre/try.main
node:_http_outgoing:879
    throw new ERR_INVALID_ARG_TYPE(
          ^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Error
    at write_ (node:_http_outgoing:879:11)
    at ServerResponse.end (node:_http_outgoing:1030:5)
    at file:///home/wmoore/Source/github.com/lustre-labs/ui/demo/build/dev/javascript/lustre/http.ffi.mjs:82:15 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.10.0

Steps to reproduce:

  1. Clone https://github.com/lustre-labs/ui
  2. cd ui/demo
  3. gleam run -m lustre/try --target javascript
  4. Open http://localhost:1234/
  5. Observe error in terminal

Environment:

OS: Arch Linux x86_64 Gleam: gleam 0.33.0 Lustre UI: 680b9ed

hayleigh-dot-dev commented 5 months ago

Hey there, thanks for this. I think this issue is resolved on main, i will publish a patch later today.

If you run gleam build first you will probably sidestep this issue, as a quick fix!

hayleigh-dot-dev commented 5 months ago

Just 3.1.3 published which should address this :) thanks for the issue.

wezm commented 5 months ago

Excellent, thank you. It's working now.