#Lustre dev server and error messages

1 messages Β· Page 1 of 1 (latest)

rain rune
#

Hello,

I'm running the gleam run -m lustre/dev start server, which works fine as long as my code compiles, but is there a way to get it to show me the error messages when it doesn't? What sort of work flow do people use when writing a Lustre app?

lilac thicket
#

the dev server shows you the compiler errors on start, and also when you keep it running it will display an overlay

rain rune
#

When you write overlay, is that in HTML?

tiny ice
#

both in the terminal and on the page

rain rune
#

That's kind of what I expected, but I'm seeing neither..

lilac thicket
#

is your editor writing backup files (with a tilde at the end) by any chance πŸ˜…

rain rune
#

I'm not sure actually, I'm using a new editor too, Helix

tiny ice
#

yeah its a known issue

#

you can verify it by zdding

[editor]
atomic-save = false

in your helix config.toml

mint sky
#

Note doing that does introduce a chance of file corruption on save if you have other tools that also work with the file at the same time

rain rune
#

Ok, I've added it to my config.toml (after adding helix to my devenv.nix because my system version didn't recognize it). It doesn't seem to change anything though.. I'm not finding any temp files either, I'm assuming they'd be in src/ ?

#

If i rm -rf build it will show warnings from libraries on startup, but nothing from my src/ where I've intentinally introduced a typo

lilac thicket
#

ok this might sound silly but:
if you open another terminal and open the file there again (or use cat) does the typo show up

rain rune
#

yep

#

it's in there

lilac thicket
#

but running gleam check doesn't report any errors?

rain rune
#

gleam check shows the error as expected

#

Could it have something to do with all of this being run in a Nix environment (devenv)?

lilac thicket
#

of course

#

nix breaks everything potentially

#

does it show up when you run gleam run -m lustre/dev build?

rain rune
#

no

#

Ok here's something.. I deleted the dist directory and ran build again, and only the index.html was written

lilac thicket
#

can you run the bun binary inside build/.lustre

tiny ice
#

it'd be helpful to share whatever output there is

tiny ice
lilac thicket
#

did you move them?

rain rune
#

I'm not sure which output you want though.. Here's from lustre/dev build:

#

Compiled in 0.07s
Running lustre/dev.main
Creating JavaScript bundle...
βœ… Bundle successfully built.
βœ… HTML generated.
βœ… Build complete!

#

It looks the same when there's an error

#

I did find the bun binary at .lustre/bin/bun-linux-x64/bun if you want me to run it

tiny ice
#

nah

lilac thicket
#

please πŸ™

tiny ice
#

thats not the problem dont waste your time

#

are you on OTP 27?

rain rune
#

That's a difficult question for a noob like me lol, how do I know?

lilac thicket
#

type erl, it will print the version

rain rune
#

Ok, yes,

#

Erlang/OTP 27 [erts-15.2.7.2] [source] [64-bit] [smp:32:16] [ds:32:16:10] [async-threads:1] [jit:ns]

tiny ice
#

you need otp 28 (and we need to do a better job detecting this)

lilac thicket
#

what

rain rune
#

Ok, so that's probably down to the version is in my nix/devenv channel or flake or whatever. That's what I get for trying to learn 5 new things at the same time

#

Thanks for the help!

tiny ice
#

i dont really know how nix works but nixpkgs does have 28.1

rain rune
#

Yeah I don't really know how it works either yet, and I suspect whatever ends up in my env is not coming directly from nixpkgs..

#

I guess it's time to learn some more 😬

tiny ice
#

so anyway the problem here is the erlang function os:cmd that we use to run the gleam compiler has an option called exception_on_failure so you can know if the cmd failed or not, but this option was only added in otp 28

#

in older otp versions the cmd will just return the cmd output as a string but otherwise not indicate that it failed, so the rest of the dev tools process just happily continues

rain rune
#

Right. That sounds like the kind of thing you'd want to know when executing a command..

tiny ice
#

yeah erlang is a bit shit for that kinda thing πŸ˜‚

rain rune
#

I guess erlang people don't do this kind of thing very ofter

#

often*

tiny ice
#

i think there are some other more-complicated ways to achieve a similar thing, but i was just reaching for the simplest

rain rune
#

Sure. I'm pretty sure the docs mentioned something like "if you need more advanced features, use a dedicated build tool" so I'm not going to sue you for false advertisement πŸ˜„

#

Anyway, I guess I'll dig into this nix/devenv stuff some more and figure out how to get the right version. Thanks again for your help!

tiny ice
#

-# or just ditch nix

rain rune
#

haha i'm tempted to but the siren song of disposable dev environments is too strong

tiny ice
#

disposable because when it doesnt work you can easily burn it down and use something else 😎

#

i jest i jest

rain rune
#

well not to hurt anyone's feelings lol but i'm basically evaluating gleam/lustre to see if it can be a replacement for elm at this point

#

and i do definitely not want any javascript ecosystem stuff installed system wide

tiny ice
#

exciting

rain rune
#

I did manage to get Erlang/OTP 28 installed, and everything is working great now πŸ™‚