- 
                Notifications
    
You must be signed in to change notification settings  - Fork 29
 
feat: add support for upstash redis #17
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
base: main
Are you sure you want to change the base?
Conversation
| 
           @Wundero is as responsive as a regular TCP redis connection ?  | 
    
          
 I don't really have any numbers for it, but I suspect it's slightly slower. I doubt the difference would be noticeable but it would likely be measurable, since upstash redis uses HTTP for connections. That being said, the purpose of this adapter isn't to improve performance, its to support the serverless usecase a bit better. Upstash's Redis client over HTTP is quite different from a standard Redis TCP socket connection, and there are incompatibilities between the two when using Upstash's product. While you can use Upstash with a normal Redis connection, if you are using the HTTP adapter in other places in your code, it makes sense to use it here as well. The main reason I made this PR was because we are using Upstash Redis for my company's product, and we wanted to implement resumable streams for our AI chat integration. In real-world usage, it seems to be quite responsive, and we haven't run into any issues using resumable streams and Upstash together (though because this isn't in the upstream package, we have to use our own adapter).  | 
    
          I'm getting this with your fork. Upstash Redis support would be phenomenal and a life saver, even if the latency is bad  | 
    
| 
           Review the following changes in direct dependencies. Learn more about Socket for GitHub. 
  | 
    
          
 I think the changes I've just pushed should hopefully address this, and it would seem upstash does some (de)serialization that other libs don't, which is why this issue can happen. Please let me know if the new stuff works for you, it seems to work for me in production but I have this particular upstash instance: import { Redis } from "@upstash/redis";
export const redis = Redis.fromEnv({
  automaticDeserialization: false,
  readYourWrites: true,
}); | 
    
| 
           for now i use this patch that seems to work with ai sdk in convex with the latst version of this package  diff --git a/node_modules/resumable-stream/dist/redis.js b/node_modules/resumable-stream/dist/redis.js
index 5d7fb67..e2539d9 100644
--- a/node_modules/resumable-stream/dist/redis.js
+++ b/node_modules/resumable-stream/dist/redis.js
@@ -1,22 +1,22 @@
 "use strict";
-var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) {
     if (k2 === undefined) k2 = k;
     var desc = Object.getOwnPropertyDescriptor(m, k);
     if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
-      desc = { enumerable: true, get: function() { return m[k]; } };
+        desc = { enumerable: true, get: function () { return m[k]; } };
     }
     Object.defineProperty(o, k2, desc);
-}) : (function(o, m, k, k2) {
+}) : (function (o, m, k, k2) {
     if (k2 === undefined) k2 = k;
     o[k2] = m[k];
 }));
-var __exportStar = (this && this.__exportStar) || function(m, exports) {
+var __exportStar = (this && this.__exportStar) || function (m, exports) {
     for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.createResumableStreamContext = exports.resumeStream = void 0;
 const get_redis_url_1 = require("./get-redis-url");
-const redis_1 = require("redis");
+const redis_1 = require("@upstash/redis");
 const runtime_1 = require("./runtime");
 __exportStar(require("./types"), exports);
 var runtime_2 = require("./runtime"); | 
    
| 
           i also have in a patches folder and i use patch-package to apply it  | 
    
This PR adds a new connector type for upstash redis.