2

I am trying to connect to a Redis server using Typescript and NodeRedis but I am constantly getting this error.

ReferenceError: queueMicrotask is not defined
    at RedisClient._RedisClient_tick (/home/administrador/Documentos/node-api-skeleton/node_modules/redis/dist/lib/client.js:378:9)
    at RedisSocket.socket_1.default.on.on.on.on (/home/administrador/Documentos/node-api-skeleton/node_modules/redis/dist/lib/client.js:301:86)
    at RedisSocket.emit (events.js:198:13)
    at RedisSocket.EventEmitter.emit (domain.js:448:20)
    at RedisSocket._RedisSocket_connect (/home/administrador/Documentos/node-api-skeleton/node_modules/redis/dist/lib/socket.js:130:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)

This the code

const redisClient = createClient();
  redisClient.on('error', (err: Error) => {
    console.log('Error', err.name);
  });
  redisClient.on('connect', () =>
    console.log('Ok'));
  try {
    await redisClient.connect();
    await redisClient.set(token, email, {
      EX: 40,
      NX: true,
    });
    await redisClient.disconnect();
  } catch (err) {
    console.log('Error', err);
  }

Am I missing something?

2 Answers 2

5

I've resolved the problem. Somehow my Node Version was 10 and queueMicrotasks are not implemented in that version. I have update Node and now it's working

Sign up to request clarification or add additional context in comments.

2 Comments

hello any help. I'm facing the same issue but in my case am using node js v16 ST, following your solution and yet nothing worked for me what could be the issue my server is running Passenger, Node js (Express) and socket.io with Redis on Centos 7
I had the same thing. restarting the terminal after upgrading to node:14 solved the problem.
0

Could be Node version, yet for me it was actually jest version, so if it happens for you only during tests - make sure to upgrade jest.

bug issue gh: https://github.com/facebook/jest/pull/9140

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.