Skip to content
Commit Detail

Commit 8704996

Author
Kenton Varda <kenton@cloudflare.com> 2025-03-12 20:22:55 -0500
Parents
c03a25b
Tree
7839305
Fix exporting a class instance as an entrypoint.

This should work:

```
class Foo {
  async fetch(req, env, ctx) { ... }
}

export default new Foo();
```

But it had a slight bug: `validateHandlers()` did not report the `fetch` method as existing. This meant you couldn't actually deploy a worker defined this way as the upload validator on the server side would reject it for not implementing `fetch`.

I asked Claude Code to fix it (as a test... I knew what the problem was). Transcript: https://claude-workerd-transcript.pages.dev/validate-handlers

Files changed

1 file changed~1 modified