diff --git a/src/utils/queryCacher.ts b/src/utils/queryCacher.ts index 69dff0d..e8ccaa2 100644 --- a/src/utils/queryCacher.ts +++ b/src/utils/queryCacher.ts @@ -21,7 +21,8 @@ async function get(fetchFromDB: () => Promise, key: string): Promise { const data = await fetchFromDB(); - redis.setExWithCache(key, config.redis?.expiryTime, JSON.stringify(data)).catch((err) => Logger.error(err)); + // Undefined can't be stringified, but null can + redis.setExWithCache(key, config.redis?.expiryTime, JSON.stringify(data ?? null)).catch((err) => Logger.error(err)); return data; }