Hacker News new | ask | show | jobs
by sfeng 2050 days ago
Workers actually can run WebAssembly [1], so any language which can target WASM works. I think the rust toolchain is best supported, but there's a fun example with Haskell [2].

[1] - https://blog.cloudflare.com/webassembly-on-cloudflare-worker...

[2] - https://blog.cloudflare.com/cloudflare-worker-with-webassemb...

1 comments

I tried getting Workers to work with a Haskell Servant application compiled with Asterius, based on [1], but kept running into various errors. [2] Example of the perils of trying to use experimental toolchains, I guess.

[1] https://www.tweag.io/blog/2020-10-09-asterius-cloudflare-wor...

[2] For the curious: the problem that eventually defeated me was the Worker responding with 404 to a route on /ip, defined in Servant. I tried defining a route on / with Servant and using that instead, but got 406 responses when doing that. First time I've ever seen that error code.

[2] Should be fairly easy to debug, as you can see what routes have actually been bound in the Cloudflare dashboard.
Are you referring to the routes set in wrangler.toml? I tried defining the /ip route there, still got 404.
Once your build code runs, wrangler takes any changes you made and writes them using the Cloudflare API. Once that's done, it should be reflected inside the dashboard on dash.cloudflare.com, and you could see what was actually set up.