Hi! When compiled to wasm, the following small application involving the net/http client completely crashes the Go runtime:
// +build js,wasm package main import ( "fmt" "net/http" "syscall/js" ) func doFetch() { res, err := http.Get("http://localhost:8181") fmt.Println(res, err) } func goFetch(this js.Value, inputs []js.Value) interface{} { doFetch() return nil } func main() { fmt.Println("Running doFetch() from wasm directly...") doFetch() fmt.Println("Now run goFetch() from javascript (this will crash):") js.Global().Set("goFetch", js.FuncOf(goFetch)) select {} } All that's needed is calling `goFetch()` in the Web browser's console, as you can see in this screenshot: https://github.com/pgaubatz/golang-wasm-http-client-bug/blob/master/screenshot.png The complete source code can be found in this repository: https://github.com/pgaubatz/golang-wasm-http-client-bug The interesting part is that executing the GET request directly from Go using `doFetch()` just works fine. Only if the request is triggered via `goFetch()` from Javascript it crashes. However, in the Web browsers network monitor it can be seen that the acutal request is sent out but the Go runtime somehow is not able to process the response. Does anyone have a clue how to debug this problem? I even tried compiling the example code with the latest Go 1.13 beta version using (albeit with not success): $ docker run --rm -v $PWD:/src -w /src golang:rc-buster Any hints are really appreciated! Thank you very much in advance! Best regards, Patrick -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/397984ef-a75b-460f-b1fd-a7637b165686%40googlegroups.com.