{"id":44775,"library":"do-redis-request","title":"do-redis-request","description":"A lightweight Redis helper function that wraps Redis commands, simplifying async calls with automatic connection handling. Current stable version 1.0.6, low release cadence. Provides a unified interface for any Redis command, reducing boilerplate. Works alongside get-redis-client and drf. No built-in retry or error handling, minimal abstraction. Suitable for small projects or rapid prototyping where full Redis client overhead is unwanted.","status":"active","version":"1.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/bitcoin-api/do-redis-request","tags":["javascript","redis","request","helper"],"install":[{"cmd":"npm install do-redis-request","lang":"bash","label":"npm"},{"cmd":"yarn add do-redis-request","lang":"bash","label":"yarn"},{"cmd":"pnpm add do-redis-request","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"recommended for creating a Redis client instance","package":"get-redis-client","optional":true}],"imports":[{"note":"Default export; do not destructure.","wrong":"const doRedisRequest = require('do-redis-request').doRedisRequest","symbol":"doRedisRequest","correct":"import doRedisRequest from 'do-redis-request'"},{"note":"CommonJS default import; destructuring results in undefined.","wrong":"const { doRedisRequest } = require('do-redis-request')","symbol":"doRedisRequest","correct":"const doRedisRequest = require('do-redis-request')"}],"quickstart":{"code":"'use strict';\n\nconst getRedisClient = require('get-redis-client');\nconst doRedisRequest = require('do-redis-request');\n\n(async () => {\n    const redisClient = getRedisClient();\n    const value = await doRedisRequest({\n        client: redisClient,\n        command: 'get',\n        redisArguments: ['redisKey'],\n    });\n    console.log('results:', value);\n    redisClient.quit();\n})();","lang":"javascript","description":"Connects to Redis, executes GET command for key 'redisKey', logs the value, then closes the connection."},"warnings":[{"fix":"Ensure the client is connected before calling doRedisRequest. Use get-redis-client or ioredis/redis to create a valid client.","message":"The 'client' option must be an active Redis client instance. Passing an undefined or closed client will cause a runtime error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always pass command names in lowercase.","message":"Command names are case-sensitive; use lowercase strings like 'get', 'set', 'hgetall'.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consult Redis command documentation for correct argument order and count.","message":"The 'redisArguments' array must contain exactly the arguments expected by the Redis command (excluding the command name). Extra or missing arguments may cause errors or unexpected results.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Implement your own retry mechanism or use a more robust library like ioredis.","message":"No automatic reconnection or retry logic. If the Redis connection drops mid-request, the promise rejects with a connection error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.6':24 'abstract':55 'alongsid':39 'async':15 'automat':18 'boilerpl':37 'built':48 'built-in':47 'cadenc':27 'call':16 'client':43,66 'command':13,35 'connect':19 'current':21 'do-redis-request':1 'drf':45 'error':52 'full':64 'function':9 'get':41 'get-redis-cli':40 'handl':20,53 'helper':8,73 'interfac':31 'javascript':70 'lightweight':6 'low':25 'minim':54 'overhead':67 'project':59 'prototyp':62 'provid':28 'rapid':61 'redi':3,7,12,34,42,65,71 'reduc':36 'releas':26 'request':4,72 'retri':50 'simplifi':14 'small':58 'stabl':22 'suitabl':56 'unifi':30 'unwant':69 'version':23 'work':38 'wrap':11","created_at":"2026-06-07T12:51:46.667160+00:00","updated_at":"2026-06-07T12:51:46.667160+00:00","problems":[{"fix":"Use `import doRedisRequest from 'do-redis-request'` (ESM) or `const doRedisRequest = require('do-redis-request')` (CJS).","cause":"Incorrect import as named export, but it's a default export.","error":"TypeError: doRedisRequest is not a function"},{"fix":"Pass a connected Redis client instance to the 'client' option.","cause":"The 'client' option is undefined or not a valid Redis client.","error":"TypeError: Cannot read properties of undefined (reading 'sendCommand')"},{"fix":"Use a Redis client from `get-redis-client` or another library that provides `quit`.","cause":"The client object does not have a quit method, likely not a Redis client.","error":"TypeError: client.quit is not a function"},{"fix":"Provide exactly one argument (the key) for GET command; e.g., 'redisArguments': ['myKey'].","cause":"Incorrect number of arguments passed in 'redisArguments' for the command.","error":"ReplyError: ERR wrong number of arguments for 'get' command"},{"fix":"Start Redis server with `redis-server` or change client configuration to point to a running instance.","cause":"Redis server is not running or unreachable.","error":"Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/bitcoin-api/do-redis-request#readme","github":"https://github.com/bitcoin-api/do-redis-request","docs":null,"changelog":null,"pypi":null,"npm":"do-redis-request","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}