Closed berkaytheunicorn closed 2 years ago
btw I was using ioredis 4.x, I upgraded to 5.x and it seems all good now.
I'm having a similar problem and haven't found a solution yet.
my redis-pub-sub.provider.ts
import { pubSubToken } from '@nestjs-query/query-graphql';
import { RedisPubSub } from 'graphql-redis-subscriptions';
import Redis from 'ioredis';
import { Provider } from '@nestjs/common';
export class RedisPubSubProvider {
static provider(): Provider {
return {
provide: pubSubToken(),
useFactory: () => {
const options = {
host: process.env.REDIS_HOST || 'localhost',
port: 6379
};
return new RedisPubSub({
publisher: new Redis(options),
subscriber: new Redis(options),
})
} ,
};
}
}
error like ;
=> ERROR [build 7/7] RUN npx nx build driver-api --prod 53.9s
[build 7/7] RUN npx nx build driver-api --prod:
nx run driver-api:build:production
chunk (runtime: main) main.js (main) 348 KiB [entry] [rendered]
ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts ./libs/database/src/lib/redis-pub-sub.provider.ts 16:10-19 [tsl] ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts(16,11) TS2322: Type 'Redis' is not assignable to type 'RedisClient'. Type 'Redis' is missing the following properties from type 'Redis': stream, isCluster, connector, reconnectTimeout, and 140 more.
ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts ./libs/database/src/lib/redis-pub-sub.provider.ts 17:10-20 [tsl] ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts(17,11) TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
ERROR in libs/database/src/lib/redis-pub-sub.provider.ts:16:11 TS2322: Type 'Redis' is not assignable to type 'RedisClient'. Type 'Redis' is missing the following properties from type 'Redis': stream, isCluster, connector, reconnectTimeout, and 140 more.
my depencies ;
"dependencies": { "@aginix/nestjs-firebase-admin": "^2.2.0", "@angular/animations": "14.0.3", "@angular/cdk": "14.0.3", "@angular/common": "14.0.3", "@angular/compiler": "14.0.3", "@angular/core": "14.0.3", "@angular/forms": "14.0.3", "@angular/google-maps": "^14.0.3", "@angular/platform-browser": "14.0.3", "@angular/platform-browser-dynamic": "14.0.3", "@angular/router": "14.0.3", "@angular/service-worker": "14.0.3", "@ant-design/icons-angular": "13.1.0", "@antv/g2": "^4.2.4", "@apollo/client": "^3.6.9", "@fastify/cors": "^7.0.0", "@fastify/multipart": "^6.0.0", "@fastify/static": "^5.0.2", "@googlemaps/google-maps-services-js": "^3.3.16", "@ingameltd/payu": "^1.0.5", "@liaoliaots/nestjs-redis": "^5.1.1", "@nestjs-query/core": "^0.30.0", "@nestjs-query/query-graphql": "^0.30.0", "@nestjs-query/query-typeorm": "^0.30.0", "@nestjs/apollo": "^10.0.16", "@nestjs/axios": "^0.0.8", "@nestjs/common": "^8.4.7", "@nestjs/config": "^2.1.0", "@nestjs/core": "^8.4.7", "@nestjs/graphql": "^10.0.16", "@nestjs/jwt": "^8.0.1", "@nestjs/passport": "^8.2.2", "@nestjs/platform-fastify": "^8.4.7", "@nestjs/schedule": "^2.1.0", "@nestjs/serve-static": "^2.2.2", "@nestjs/typeorm": "8.0.4", "@nestjs/websockets": "^8.4.7", "@nrwl/angular": "14.3.6", "@nrwl/web": "14.3.6", "@paypal/checkout-server-sdk": "^1.0.3", "@types/node": "^18.0.0", "apollo-angular": "^3.0.1", "apollo-server-core": "^3.10.2", "apollo-server-fastify": "^3.10.2", "autoprefixer": "^10.4.7", "class-transformer": "0.4.0", "class-validator": "0.13.2", "dataloader": "^2.1.0", "dotenv": "16.0.1", "graphql": "^16.6.0", "graphql-redis-subscriptions": "2.5.0", "graphql-relay": "^0.9.0", "graphql-subscriptions": "^2.0.0", "graphql-tools": "^8.2.13", "instamojo-payment-nodejs": "^3.0.0", "ioredis": "^4.28.5", "json-2-csv": "^3.17.1", "jwt-decode": "^3.1.2", "mercadopago": "^1.5.13", "mysql": "^2.18.1", "ng-zorro-antd": "^13.3.2", "ngx-timeago": "^2.0.0", "node-rsa": "^1.1.1", "passport": "^0.6.0", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", "paystack-node": "^0.3.0", "paytm-pg-node-sdk": "^1.0.4", "paytmchecksum": "^1.5.0", "razorpay": "^2.8.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5", "stripe": "^9.10.0", "tslib": "^2.4.0", "typeorm": "0.2.45", "zone.js": "0.11.6" }, "devDependencies": { "@angular-devkit/build-angular": "14.0.3", "@angular-eslint/eslint-plugin": "14.0.0", "@angular-eslint/eslint-plugin-template": "14.0.0", "@angular-eslint/template-parser": "14.0.0", "@angular/cli": "~14.0.3", "@angular/compiler-cli": "14.0.3", "@angular/language-service": "14.0.3", "@bartholomej/ngx-translate-extract": "^8.0.2", "@graphql-codegen/cli": "^2.6.2", "@graphql-codegen/introspection": "^2.1.1", "@graphql-codegen/typescript": "^2.5.1", "@graphql-codegen/typescript-apollo-angular": "^3.4.12", "@graphql-codegen/typescript-operations": "^2.4.2", "@nestjs/schematics": "^8.0.11", "@nestjs/testing": "^8.4.7", "@ngx-translate/core": "^14.0.0", "@ngx-translate/http-loader": "^7.0.0", "@nrwl/cli": "14.3.6", "@nrwl/eslint-plugin-nx": "14.3.6", "@nrwl/jest": "14.3.6", "@nrwl/linter": "14.3.6", "@nrwl/nest": "14.3.6", "@nrwl/node": "14.3.6", "@nrwl/workspace": "14.3.6", "@nxrocks/nx-flutter": "^3.0.2", "@tailwindcss/forms": "^0.5.2", "@tailwindcss/typography": "^0.5.2", "@types/busboy": "^1.5.0", "@types/cron": "^2.0.0", "@types/estree": "0.0.52", "@types/ioredis": "4.28.10", "@types/jest": "29.0.0", "@types/paypal__checkout-server-sdk": "^1.0.4", "eslint-config-prettier": "8.5.0", "jest": "29.0.2", "jest-preset-angular": "12.1.0", "json-autotranslate": "^1.10.3", "ng-packagr": "14.0.2", "nx": "14.3.6", "postcss": "^8.4.14", "postcss-import": "14.1.0", "postcss-preset-env": "7.7.2", "postcss-url": "10.1.3", "prettier": "2.7.1", "tailwindcss": "^3.1.4", "ts-jest": "29.0.0", "ts-node": "10.8.1", "typescript": "4.7.4" }
I was using it like below, this was working with v2.4.2 but now I'm getting this error.
Type 'Redis' is not assignable to type 'RedisClient'