-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hey team,
I am running riverui with SQLite and its humming along perfectly but I did hit a panic (with workaround).
For context I am using:
- Pocketbase (a SQLite based Go app)
github.com/riverqueue/river v0.30.0github.com/riverqueue/river/riverdriver/riversqlite v0.30.0riverqueue.com/riverui v0.14.0
(I only just noticed latest is now v0.30.2 I will update)
When accessing the queues page in the UI on a fresh database I get a panic
[PANIC RECOVER] runtime error: invalid memory address or nil pointer dereference goroutine 26110 [running]:
github.com/pocketbase/pocketbase/apis.NewRouter.panicRecover.func3.1()
/go/pkg/mod/github.com/pocketbase/pocketbase@v0.36.1/apis/middlewares.go:269 +0x13c
panic({0x15ad780?, 0x29bb1d0?})
/usr/local/go/src/runtime/panic.go:783 +0x132
riverqueue.com/riverui.riverQueueToSerializableQueue({{0x1e477700, 0xee10c952c, 0x0}, {0xc000352590, 0x2, 0x8}, {0xc0003522d8, 0x8}, 0x0, {0x2ebae40, ...}}, ...)
/go/pkg/mod/riverqueue.com/riverui@v0.14.0/handler_api_endpoint.go:1029 +0x8d
riverqueue.com/riverui.riverQueuesToSerializableQueues({0xc0001babc0, 0x4, 0xc000142fc0?}, {0xc0003e8c90, 0x2, 0xc000142fc0?})
/go/pkg/mod/riverqueue.com/riverui@v0.14.0/handler_api_endpoint.go:1047 +0x1da
riverqueue.com/riverui.(*queueListEndpoint[...]).Execute.func1({0x1ff36e0, 0xc0001e6540})
/go/pkg/mod/riverqueue.com/riverui@v0.14.0/handler_api_endpoint.go:662 +0x2f6
github.com/riverqueue/river/rivershared/util/dbutil.WithTxV[...]({0x1fd9528?, 0xc000142fc0}, {0x1fefef0, 0xc00007c1c0?}, 0xc00044aa10?)
/go/pkg/mod/github.com/riverqueue/river/rivershared@v0.30.0/util/dbutil/db_util.go:66 +0x15e
riverqueue.com/riverui.(*queueListEndpoint[...]).Execute(0x1594400?, {0x1fd9528?, 0xc000142fc0?}, 0x15e1520?)
/go/pkg/mod/riverqueue.com/riverui@v0.14.0/handler_api_endpoint.go:644 +0x55
github.com/riverqueue/apiframe/apiendpoint.executeAPIEndpoint[...].func1(0xc0003f1ce0, {0x1fd9528, 0xc000142fc0}, 0xc00044ad60, {0x1fd71c0, 0xc00036b260}, 0xc0002f6d08, 0x1fddd40)
/go/pkg/mod/github.com/riverqueue/apiframe@v0.0.0-20251229202423-2b52ce1c482e/apiendpoint/api_endpoint.go:177 +0x1ce
github.com/riverqueue/apiframe/apiendpoint.executeAPIEndpoint[...]({0x1fd71c0, 0xc00036b260}, 0xc0001ac3c0, 0xc000044f70, 0xc0002f6d08, 0xc0003f1ce0, 0xc00044ad60)
/go/pkg/mod/github.com/riverqueue/apiframe@v0.0.0-20251229202423-2b52ce1c482e/apiendpoint/api_endpoint.go:199 +0x106
github.com/riverqueue/apiframe/apiendpoint.Mount[...].func1(0xc00044adc8?)
/go/pkg/mod/github.com/riverqueue/apiframe@v0.0.0-20251229202423-2b52ce1c482e/apiendpoint/api_e
I was able to move past this by seeding "dummy" jobs to my queues if they are empty.
For anyone else that might hit this I'll add the seed code I am using.
Seed snippet
func (c *Client) seedEmptyQueues(ctx context.Context) error {
query := `
INSERT INTO river_job (state, queue, args, created_at, finalized_at, kind, max_attempts, priority, scheduled_at, attempt, attempted_at)
SELECT 'completed', q.name, '{}', datetime('now'), datetime('now'), 'queue_seed', 1, 1, datetime('now'), 1, datetime('now')
FROM river_queue q
WHERE q.name NOT IN (SELECT DISTINCT queue FROM river_job)
`
result, err := c.db.ExecContext(ctx, query)
if err != nil {
return fmt.Errorf("failed to seed empty queues: %w", err)
}
if rows, _ := result.RowsAffected(); rows > 0 {
c.app.Logger().Info("Seeded empty queues for River UI compatibility", "queues_seeded", rows)
}
return nil
}Thanks, and this is my first time using the sqlite driver (big fan of the PG one) and it's been working really well!
Metadata
Metadata
Assignees
Labels
No labels