Open intellizetm opened 1 year ago
unfortunately this is because of no ioredis 5 support, if you use ioredis@4.28.5 it should work.
hopefully this lib isn't dead, as I need ioredis 5..
its same issue sir.I coudnt solve this issue for a few months.and my depencies ;
"private": true, "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", "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": "^15.7.2", "graphql-redis-subscriptions": "^2.4.2", "graphql-relay": "^0.9.0", "graphql-subscriptions": "1.2.1", "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/node": "^18.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'm not sure then, the only real differences I see in your deps are a few versions older on things like: "graphql-redis-subscriptions": "^2.5.0", "graphql-subscriptions": "^2.0.0",
I'm also using the ptc-org fork of nestjs-query as its actively maintained, but I don't think that's your issue. "@ptc-org/nestjs-query-core": "^1.1.4", "@ptc-org/nestjs-query-graphql": "^1.1.4", "@ptc-org/nestjs-query-typeorm": "^1.1.4",
my provider class that's working with graphql-redis-subscriptions 2.5.0 and ioredis 4.28.5 is below, but it's basically the same (I inject config, and have a date reviver so updatedAt timestamps work).. so not sure it'll help.
import { Provider } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { pubSubToken } from '@ptc-org/nestjs-query-graphql';
import { RedisPubSub } from 'graphql-redis-subscriptions';
import Redis from 'ioredis';
export class RedisPubSubProvider {
static provider(): Provider {
return {
provide: pubSubToken(),
inject: [ConfigService],
useFactory: async (config: ConfigService) => {
const dateReviver = (key, value) => {
const isISO8601Z = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/;
if (typeof value === 'string' && isISO8601Z.test(value)) {
const tempDateNumber = Date.parse(value);
if (!isNaN(tempDateNumber)) {
return new Date(tempDateNumber);
}
}
return value;
};
const redisOptions = {
sentinels: config.get<boolean>('SENTINEL_ENABLED')
? [
{
host: config.get('REDIS_HOST'),
port: config.get('REDIS_PORT'),
},
]
: undefined,
host: config.get<boolean>('SENTINEL_ENABLED') ? undefined : config.get('REDIS_HOST'),
password: config.get('REDIS_PASSWORD'),
sentinelPassword: config.get<boolean>('SENTINEL_ENABLED')
? config.get('REDIS_PASSWORD')
: undefined,
name: config.get<boolean>('SENTINEL_ENABLED') ? 'mymaster' : undefined,
};
return new RedisPubSub({
publisher: new Redis(redisOptions),
subscriber: new Redis(redisOptions),
reviver: dateReviver,
});
},
};
}
}
after updating from ioredis 5.2.4 to 5.3.1 i got the same error.
after updating from ioredis 5.2.4 to 5.3.1 i got the same error.
I am also getting the same error on package update. Hence stuck for now with the older ioredis.
The only way working out for me is to force the ioredis
version for all packages by adding it to the resolutions
in package.json
; as long as there's no breaking change between the version you're forcing in and the version initially used by the packages then it should work as expected.
The breaking changes from v5.0.0 does not seem to be an issue, or so far I never got to see it.
my redis-pub-sub.provider.ts like below ;
and error like ;