Next.js Discord

Discord Forum

Module not found: Can't resolve 'tls' when using redis on middlware

Answered
Mugger Crocodile posted this in #help-forum
Open in Discord
Mugger CrocodileOP
why im getting this error when using redis client.

./node_modules/.pnpm/ioredis@5.3.2/node_modules/ioredis/built/connectors/SentinelConnector/index.js:6:14 Module not found: Can't resolve 'tls' 4 | const net_1 = require("net"); 5 | const utils_1 = require("../../utils"); > 6 | const tls_1 = require("tls"); | ^^^^^^^^^^^^^^ 7 | const SentinelIterator_1 = require("./SentinelIterator"); 8 | exports.SentinelIterator = SentinelIterator_1.default; 9 | const AbstractConnector_1 = require("../AbstractConnector"); https://nextjs.org/docs/messages/module-not-found
Answered by Giant panda
The middleware runs on Edge and not on Node and thus many APIs aren't available. In this case ioredis is incompatible with Edge.
View full answer

1 Reply

Giant panda
The middleware runs on Edge and not on Node and thus many APIs aren't available. In this case ioredis is incompatible with Edge.
Answer