-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
I followed by guide this nestjs redis and but still get the error: "error: Invalid protocol" . please tell me what to do?
redis.client.ts
import { Redis } from "@upstash/redis";
export const createRedisClient = (restUrl: string, restToken: string) => {
const redis = new Redis({
url: restUrl,
token: restToken,
});
return redis;
};
redis.module.ts
import { Module } from '@nestjs/common';
import { RedisService } from './redis.service';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { RedisRepository } from './redis.repository';
import { createRedisClient } from './redis-client';
@Module({
imports: [ConfigModule.forRoot({ isGlobal: true })],
providers: [
RedisService,
{
provide: 'RedisClient',
useFactory: (config: ConfigService) => {
const url = config.get<string>('REDIS_URL');
const token = config.get<string>('REDIS_TOKEN');
if (!url || !token) {
throw new Error('Empty fields');
}
return createRedisClient(url, token);
},
inject: [ConfigService],
},
RedisRepository,
],
exports: [RedisService, RedisRepository],
})
export class RedisModule {}
my data in .env looks similiar like this:
UPSTASH_REDIS_REST_URL="https://us1-XXX-38101.upstash.io"
UPSTASH_REDIS_REST_TOKEN="AZTVACQXXXVhOTktYzI0Mi0XXXM4ZmQzMjI3NDY0NTZmNDXXXYjQ0NGY4MGYwNDI="
Please tell me what to do. Yesterday I tried contacting support, but they haven’t resolved my problem.
Does anyone have any idea what might be causing this issue? Where should I look for the mistake?
I’d really appreciate any help to solve my problem. Thank you!
Thank you
Metadata
Metadata
Assignees
Labels
No labels