Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A HandlerFunc without writing a response body causes weird error #101

Open
syumai opened this issue Apr 16, 2024 · 0 comments
Open

A HandlerFunc without writing a response body causes weird error #101

syumai opened this issue Apr 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@syumai
Copy link
Owner

syumai commented Apr 16, 2024

func main() {
	http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
		// doing nothing here causes weird error
	})
	workers.Serve(nil) // use http.DefaultServeMux
}
$ curl localhost:8787
TypeError: Cannot read properties of undefined (reading 'exports')
    at syscall/js.valueNew (file:///home/syumai/go/src/github.com/syumai/workers-playground/syumai-workers-repro-issue-100/build/wasm_exec.js:395:24)
    at [object Object]
    at [object Object]
    at [object Object]
    at [object Object]
    at [object Object]
    at globalThis.Go._resume (file:///home/syumai/go/src/github.com/syumai/workers-playground/syumai-workers-repro-issue-100/build/wasm_exec.js:553:23)
    at Object.handleRequest (file:///home/syumai/go/src/github.com/syumai/workers-playground/syumai-workers-repro-issue-100/build/wasm_exec.js:564:8)
    at Object.fetch (file:///home/syumai/go/src/github.com/syumai/workers-playground/syumai-workers-repro-issue-100/build/shim.mjs:51:18)
    at async jsonError (file:///home/syumai/.nvm/versions/node/v20.12.2/lib/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)

How to reproduce

Run How to reproduce steps in the repository below.

https://github.com/syumai/workers-playground/tree/main/syumai-workers-repro-issue-100

@syumai syumai added the bug Something isn't working label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant