data type is changing between `.hset()` and `.hget()`
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 595
- Forks
- 101
- Avg merge
- 2h 24m
- Merged PRs (30d)
- 1
Description
.hget() does not return the type that has been set with .hset()
await kv.hset(`key`, { code1: '123456', code2: '000001' }) // code is a string
const value = await kv.hgetall(`key`)
console.log(typeof value.code1) // code is a number
console.log(typeof value.code2) // code is a string
With automaticDeserialization: false as mentioned here: https://github.com/vercel/storage/issues/250
console.log(typeof value) // value is an 'object'
console.log(typeof value.code) // code is undefined
console.log(typeof JSON.parse(value)) // is not a valid JSON
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the KV hset(), hget(), and hgetall() entry points described in the report, then trace how values are serialized and deserialized, including automaticDeserialization: false. Done means values such as "123456" and "000001" retain their intended types across hset() and hgetall(), with regression coverage for both configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100