I'm attempting to establish a connection with upstash's redis using the code snippet below. However, I am encountering an error.
Can you identify what the issue might be?
【code】
import { Redis } from "@upstash/redis";
const redis = new Redis({
url: process.env.UPSTASH_REDIS_URL,
token: process.env.UPSTASH_REDIS_TOKEN
});
【error】
- error node_modules\@upstash\redis\esm\platforms\nodejs.js (27:36) @ startsWith
- error Error [TypeError]: Cannot read properties of undefined (reading 'startsWith')
at new Redis (webpack-internal:///(rsc)/./node_modules/@upstash/redis/esm/platforms/nodejs.js:30:37)
at eval (webpack-internal:///(rsc)/./app/upstash/page.tsx:10:15)
at (rsc)/./app/upstash/page.tsx (C:\SourceCode\nextjs\.next\server\app\upstash\page.js:975:1)
at Function.__webpack_require__ (C:\SourceCode\nextjs\.next\server\webpack-runtime.js:33:42)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (C:\SourceCode\nextjs\node_modules\next\dist\build\utils.js:828:17) {
digest: undefined
}