The error arises when attempting a KV operation (set or get) in Vercel after creating an entry using a different data structure.
Replicating the error
await kv.set('userSession', '123abc');
Subsequently, we opt to change the data structure.
await kv.hset('userSession', { userId: 123, email: 'ex@example.com' });
Error:
UpstashError: WRONGTYPE Operation against a key holding the wrong kind of value, command was: ["hset","userSession", ...]
Solution
Remove the key from Vercel before modifying the data structure.
- Go to Vercel: https://vercel.com/dashboard/stores/kv
- Delete that key:
DEL userSession
Top comments (0)