Skip to content

ERR syntax error when using SET #357

@haziqfiqri

Description

@haziqfiqri

os: Windows_NT 10.0.19042 x64 v0.30.6
version: 2.3.1
redis: 3.2.100
node: 12.13.0

os: mac
version: 2.3.1
redis: v=6.2.6 sha=00000000:0 malloc=libc bits=64 build=c6f3693d1aced7d9
node: 14.16.0

I have this piece of code which acts as an interceptor in the controller level which run fine on mac but not on my windows pc. Can verify why this is happening?

code:

async intercept(
        context: ExecutionContext,
        next: CallHandler,
    ): Promise<Observable<unknown>> {
        const request = context.switchToHttp().getRequest<Request>();
        const projectId = request.body['project']?.id;

        const expirySeconds = parseInt(process.env.REDIS_CACHE_SEC);
        const expiryKey = `${projectId}:expiry`;
        const dataKey = `${projectId}:data`;
        const pxAt = new Date().getTime() + expirySeconds * 1000;

        const data = await this.redisClient.set(
            dataKey,
            '1',
            ['PXAT', pxAt],
            'GET',
        );

        if (!data) {
            await this.redisClient.set(expiryKey, pxAt.toString(), [
                'PXAT',
                pxAt,
            ]);
            return next.handle();
        }

        return of([]);
    }

error:

"ReplyError: ERR syntax error\n at parseError (C:\\Users\\User\\Desktop\\project\\node_modules\\redis-parser\\lib\\parser.js:179:12)\n at parseType (C:\\Users\\User\\Desktop\\project\\node_modules\\redis-parser\\lib\\parser.js:302:14)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions