go-app: go-app v10 does not work in MacOS Safari

I’m trying to upgrade go-app from v9 to v10 -> https://github.com/rtrzebinski/simple-memorizer-4/tree/go-app-v10

go-app v10 does not work in MacOS Safari browser

It works fine in Google Chrome.

I checked on 2 (Mac) computers - same result.

I use incognito mode to ensure it’s no caching issue.

Error displayed in Safari -> TypeError: TypeError: Load failed.

In console I see it’s related to this part:

loading wasm failed: TypeError: TypeError: Load failed

  try {
    const showProgress = (progress) => {
      loaderLabel.innerText = goappLoadingLabel.replace("{progress}", progress);
    };
    showProgress(0);

    const go = new Go();
    const wasm = await instantiateStreaming(
      fetchWithProgress("/web/app.wasm", showProgress),
      go.importObject
    );

    go.run(wasm.instance);
    loader.remove();
  } catch (err) {
    loaderIcon.className = "goapp-logo";
    loaderLabel.innerText = err;
    console.error("loading wasm failed: ", err);  // <<<--- error is printed here "loading wasm failed: TypeError: TypeError: Load failed"
  }
}

The file exists:

$ ls web/app.wasm 
web/app.wasm

Anyone has this problem before? Thanks in advance for any help.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 31 (14 by maintainers)

Most upvoted comments

@XenoPhex Thank you, it worked!

I switched to HTTPS with self signed certificate and go-app now refreshes normally in Safari.

I generated certificate with cli however:

# Create a private key
openssl genrsa -out localhost-key.pem 2048

# Create a certificate signing request (CSR)
openssl req -new -key localhost-key.pem -out localhost.csr -subj "/CN=localhost"

# Create the self-signed certificate (valid for 1 year)
openssl x509 -req -days 365 -in localhost.csr -signkey localhost-key.pem -out localhost-cert.pem

# Clean up the CSR file
rm localhost.csr

Commit for the reference -> https://github.com/rtrzebinski/simple-memorizer-4/pull/6/commits/912ca49b3757a57d0f48342732666e2208353446

@rtrzebinski I just gave another try to fix that but it is going nowhere so far. From what I read on and on is that safari is forcing https on localhost. I tried different things I gathered online and none worked for me. The .wasm loading keeps failing.