Skip to content

Commit

Permalink
fix: minor repair of meta key-values
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr13 committed Dec 24, 2024
1 parent 456bd7a commit 23da574
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,16 @@ class Client {
// stringify meta values and limit keys and values length to 255
meta = Object.entries(meta)
.filter(([, value]) => value !== null && value !== undefined)
.filter(([, value]) => value !== null && value !== undefined && typeof value.toString === 'function')
.map(([key, value]) => {
try {
key = key.toString();
if (typeof value === 'object') {
value = JSON.stringify(value);
} else if (typeof value !== 'string') {
value = value.toString();
try {
value = value.toString();
} catch (err) {
console.warn(APP_PREFIX, `Can't convert meta value to string`, err);
}
}

if (value.length > 255) {
Expand Down

0 comments on commit 23da574

Please sign in to comment.