Bug Description
SqliteCacheStore#createWriteStream() enforces maxEntrySize incorrectly for streamed cache writes.
Reproducible By
import { strictEqual } from 'node:assert'
import { once } from 'node:events'
import { cacheStores } from 'undici'
const body = Buffer.from('abc')
const maxEntrySize = body.byteLength
const now = Date.now()
const value = {
statusCode: 200,
statusMessage: 'OK',
headers: {},
cachedAt: now,
staleAt: now + 60_000,
deleteAt: now + 120_000
}
const key = (path) => ({
origin: 'https://example.com',
method: 'GET',
path,
headers: {}
})
const store = new cacheStores.SqliteCacheStore({ maxEntrySize })
const stream = store.createWriteStream(key('/stream'), value)
stream.end(body)
await once(stream, 'close')
strictEqual(store.get(key('/stream')).body.toString(), 'abc')
store.close()
Expected Behavior
Assertion to be successful, as body is of maxEntrySize
const body = Buffer.from('abc')
const maxEntrySize = body.byteLength
Logs & Screenshots
An error is thrown since the entry is undefined
strictEqual(store.get(key('/stream')).body.toString(), 'abc')
^
TypeError: Cannot read properties of undefined (reading 'body')
at file:///Users/trivikram/workspace/test-repro/test.mjs:31:38
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
Node.js v24.15.0
Environment
macOS 26.4.1
Node v24.15.0
undici v8.1.0
Bug Description
SqliteCacheStore#createWriteStream()enforcesmaxEntrySizeincorrectly for streamed cache writes.Reproducible By
Expected Behavior
Assertion to be successful, as
bodyis ofmaxEntrySizeLogs & Screenshots
An error is thrown since the entry is undefined
Environment
macOS 26.4.1
Node v24.15.0
undici v8.1.0