question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with importing ioredis

See original GitHub issue

The example code used in section Creating the Redis Client of the readme has the following import:

import * as Redis from 'ioredis';

This results in an error message:

publisher: new Redis(options),
           ^

TypeError: Redis is not a constructor

To fix this, you simply need to change the import to:

import Redis from 'ioredis';

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
TheEhsanSarsharcommented, Jan 20, 2020

try to import it like this const Redis = require('ioredis') commonjs like

0reactions
thiendangcommented, Apr 28, 2022

try to import it like this const Redis = require('ioredis') commonjs like

Thanks TheEhsanSarshar . It’s work well for me!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

issues after upgrading ioredis to v5.0.1 - Stack Overflow
Our original code to create redis clients import Redis, { Redis as RedisClient, Cluster, ClusterOptions } from 'ioredis'; import config from ...
Read more >
ioredis - npm
A robust, performance-focused and full-featured Redis client for Node.js.. Latest version: 5.2.4, last published: 2 months ago.
Read more >
Redis with Node.js (ioredis) | Redis Documentation Center
The following sections demonstrate the use of ioredis, a community-recommended Redis client for Node.js with build-in support for promises.
Read more >
How to use the ioredis.Cluster function in ioredis - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately. Enable here. github lawrips /...
Read more >
liaoliaots/nestjs-redis-health - NPM Package Overview
Redis(ioredis) health checks module for Nest framework (node.js). ... Dependencies have 1 critical issue. Install scripts ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found