🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(redis): disable automatic deserialization in upstash provider (#11210)
YuTengjingeb5c76ca4b2a
diff --git a/src/app/(backend)/f/[id]/route.ts b/src/app/(backend)/f/[id]/route.tsindex 33010148af4..40e431cbd6d 100644--- a/src/app/(backend)/f/[id]/route.ts+++ b/src/app/(backend)/f/[id]/route.ts@@ -43,8 +43,8 @@ export const GET = async (_req: Request, segmentData: { params: Params }) => {const cacheKey = buildCacheKey(id);if (redisClient) {- // Upstash Redis auto-deserializes JSON, so cached is already an object- const cached = (await redisClient.get(cacheKey)) as CachedFileData | null;+ const cachedStr = await redisClient.get(cacheKey);+ const cached = cachedStr ? (JSON.parse(cachedStr) as CachedFileData) : null;if (cached?.redirectUrl) {log('Cache hit for file: %s', id);return Response.redirect(cached.redirectUrl, 302);diff --git a/src/libs/better-auth/define-config.ts b/src/libs/better-auth/define-config.tsindex 03abb5cb400..33b7340e3c9 100644--- a/src/libs/better-auth/define-config.ts+++ b/src/libs/better-auth/define-config.ts@@ -64,10 +64,7 @@ const enabledSSOProviders = parseSSOProviders(authEnv.AUTH_SSO_PROVIDERS);const { socialProviders, genericOAuthProviders } = initBetterAuthSSOProviders();async function customEmailValidator(email: string): Promise<boolean> {- if (ENABLE_BUSINESS_FEATURES && !(await businessEmailValidator(email))) {- return false;- }- return validateEmail(email);+ return ENABLE_BUSINESS_FEATURES ? businessEmailValidator(email) : validateEmail(email);}interface CustomBetterAuthOptions {diff --git a/src/libs/redis/upstash.ts b/src/libs/redis/upstash.tsindex 3a8a15b81df..b2ccd7c910d 100644--- a/src/libs/redis/upstash.ts+++ b/src/libs/redis/upstash.ts@@ -25,7 +25,10 @@ export class UpstashRedisProvider implements BaseRedisProvider {constructor(options: UpstashConfig | RedisConfigNodejs) {const { prefix, ...clientOptions } = options as UpstashConfig & RedisConfigNodejs;this.prefix = prefix ? `${prefix}:` : '';- this.client = new Redis(clientOptions as RedisConfigNodejs);+ this.client = new Redis({+ ...clientOptions,+ automaticDeserialization: false,+ } as RedisConfigNodejs);}/**