net/http: HTTP requests failing with 'Protocol not available' on wasm/js when running in browser #59605
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When doing a simple HTTP GET in a Go library compiled for wasm/js, all versions Go 1.18 and later are failing when running inside Chrome with
dial tcp: lookup <some_domain>: Protocol not available
.When running on Go 1.17, this works fine. But Go 1.18 and later give the error above
The issue seems to be introduced by 2666262 and possibly made worse by 4c5d979. These commits seem to try to "autodetect" a Node environment by checking the presence of certain browser settings. While that may have been valid at time of committing, it seems the assumptions on which they were based no longer hold for more recent browser versions.
Perhaps a more direct/explicit way of checking whether we're running in a Node or browser environment would be more suitable? The methods above look a bit hacky
The text was updated successfully, but these errors were encountered: