-
Notifications
You must be signed in to change notification settings - Fork 55
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
redis.set randomly stops working #977
Comments
It happens randomly too and I cannot predict when and why it happens |
In NextJS if you don't |
How do you correctly use await? |
What I meant was that sometimes, floating promises (promises that you don't await) behave differently in serverless functions. Perhaps that was the issue? |
I encounter similar issue as the others when i use nextjs runtime = "nodejs", my chatbot can work properly. but when i use runtime="edge", it works fine in dev environment however, when pushed onto vercel, it leads to very unpredictable outcome. sometimes, the new chat is written into upstash redis but sometimes, it doesn't. anyone knows how can i resolve this issue? below is my api/chat/route.ts code...
|
@myhendry can you try converting |
@ogzhanolguncu hi, im using runtime="nodejs" environment instead of runtime="edge". let me try using invoke. so code will be... i dont need the "await" keyword before chain.invoke right? thanks
|
No, if you are streaming you don't have to. If you are not streaming you have to await till you get a result back. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not sure if this is still relevant but i would suggest you update to teh newest version of ai package from vercel and try using the callback function onFinal. So like this here:
This should work just fine i have used it for many month. Also the Langchain buffer memory i would not use. I would in general avoid using langchain overall and just stick with the AI package from vercel, it contains everything you need :) The function:
is just a basic function that takes these input and stores the value in upstash/redis The partialcompletion is if the stream is suddenly cut off or the user stops it, it then still stores what ever that have been generated in the chat memory. |
It's seemingly random but when I sometimes set some data in the redis db, it just doesn't save. I see the key in the database but not the value.
when I check the data browser in my dashboard, I can find the key but the value looks like this:
The text was updated successfully, but these errors were encountered: