Hello
roc crash on first http request with any basic-webserver example
for example with this code:
app [Model, server] { pf: platform "https://github.com/roc-lang/basic-webserver/releases/download/0.7.0/wBzpUZavn70SpVSh8GpfH0YaXM3ydMbu8s4eAiPC-Ko.tar.br" }
import pf.Stdout
import pf.Task exposing [Task]
import pf.Http exposing [Request, Response]
import pf.Utc
Model : {}
server = { init: Task.ok {}, respond }
respond : Request, Model -> Task Response [ServerErr Str]_
respond = \req, _ ->
# Log request datetime, method and url
datetime = Utc.now! |> Utc.toIso8601Str
Stdout.line! "$(datetime) $(Http.methodToStr req.method) $(req.url)"
# Respond with request body
if List.isEmpty req.body then
Task.ok { status: 200, headers: [], body: [] }
else
Task.ok { status: 200, headers: [], body: req.body }
I have this error:
Listening on <http://127.0.0.1:8000>
2024-08-20T22:17:33Z Get /
free(): invalid pointer
fish: Job 1, 'roc run test.roc --linker=legacy' terminated by signal SIGABRT (Abort)
roc version:
roc nightly pre-release, built from commit 070d14a on Sa 13 Jul 2024 09:01:39 UTC
on Linux
Are you using roc built from source? or a nightly? for that version of the webserver you probably need the TESTING nightly or roc built from main.
It's not normally the case that versions are like this -- we have just had a bug for a couple of weeks we want to resolve before upgrading the releases to nightly.
The latests releases are always kept in sync and tested together (along with all the website examples), so if you're using a pre-release things are unstable.
ok with the TESTING version it's working
thanks
Florian Le Roux has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC