-
Notifications
You must be signed in to change notification settings - Fork 108
KV binding defaults to STORAGE when driver explicitly set #766
Copy link
Copy link
Closed
Description
when working on #765, i found that when explicitly setting driver: 'cloudflare-kv-binding' in hub.kv config, the binding property is not set to default 'KV', causing unstorage to use 'STORAGE'.
Reproduce
// nuxt.config.ts
export default defineNuxtConfig({
hub: {
kv: {
driver: 'cloudflare-kv-binding',
namespaceId: '<id>'
}
}
})Deploy to Cloudflare Workers → 500 error: [unstorage] [cloudflare] Invalid binding 'STORAGE': undefined
Cause
resolveKVConfig() in src/kv/setup.ts returns early when driver is explicitly set (line 16), skipping the Cloudflare defaults merge at lines 48-51 that adds binding: 'KV'.
Workaround
Add binding: 'KV' explicitly.
Expected
binding: 'KV' should be merged even when driver is explicitly specified.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels