Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR syntax error when using SET #357

Open
haziqfiqri opened this issue Feb 25, 2022 · 0 comments
Open

ERR syntax error when using SET #357

haziqfiqri opened this issue Feb 25, 2022 · 0 comments

Comments

@haziqfiqri
Copy link

haziqfiqri commented Feb 25, 2022

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)"
@haziqfiqri haziqfiqri changed the title ERR syntax error ERR syntax error when using SET Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant