cloudflare / cloudflare/partykit
partywhen Scheduler crashes in miniflare/wrangler local dev (SQL init in constructor)
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
**Package:** `partywhen@0.1.4`
The `Scheduler` class uses `this.ctx.storage.sql.exec()` inside `blockConcurrencyWhile` in the constructor. This crashes in miniflare/wrangler local dev with a 500 Internal Server Error.
**Reproduction:**
```typescript
// worker.ts
import { Scheduler } from 'partywhen';
export { Scheduler };
export default {
async fetch(request, env) {
// route to Scheduler DO
}
};
```
```toml
# wrangler.toml
compatibility_date = "2025-04-01"
compatibility_flags = ["nodejs_compat"]
[durable_objects]
bindings = [{ name = "SCHEDULER", class_name = "Scheduler" }]
```
```bash
$ npx wrangler dev --port 1999
# Server starts OK
$ curl http://localhost:1999/parties/scheduler/test-room
# 500 Internal Server Error
```
The Scheduler's `status()` method works fine conceptually, but the SQL table creation in the constructor fails before any request is handled.
**Expected:** Scheduler should work in local dev with `wrangler dev`. The SQL init should gracefully handle miniflare's SQLite implementation.
**Workaround:** None — the Scheduler is unusable in local dev. We mark the test as `it.fails` to document the behavior.
**Context:** Testing all PartyKit packages against real wrangler dev. partyserver, partysub, partyfn all work. Only partywhen fails. See [our test suite](https://github.com/joeblew999/plat-trunk/blob/main/systems/sync/test/partykit/scheduler.test.ts).
Contributor guide
Assessment
This issue has not been assessed yet.