Rayy
CCConvex Community
•Created by Rayy on 6/3/2024 in #support-community
Getting adapter error with Next Auth and Convex in production.
My application works fine in development, and I am able to authenticate without any errors, but after deploying to vercel I get the following error
I have followed this (https://docs.convex.dev/production/hosting/vercel) to deploy my project and have set up the necessary environment variables, and also set up the callbacks for the specific providers, but I am yet getting this error. Can someone please help me out with this?
4 replies
CCConvex Community
•Created by Rayy on 5/21/2024 in #support-community
Unable to authenticate Convex with next auth when provider is Credentials.
I have followed this post to setup the adapter https://stack.convex.dev/nextauth-adapter, and authenticate Convex with next auth, and it works with providers with github and google, but it does not with credentials.
I am able to authenticate in the client side still with credentials, but unable to authenticate the same with Convex. It is not returning any sessions with credentials provider.
Here is my auth.ts
I feel like I need to access the token callback to pass theJWT.
Have I missed something in the docs?
19 replies
CCConvex Community
•Created by Rayy on 5/20/2024 in #support-community
How to access mutations/queries from authAdapters in next auth convex setup?
I followed through this https://stack.convex.dev/nextauth-adapter and was able to setup adapters for convex, and my application works just fine.
Currently I am using mutations I created to
createUser
or stuff like that, but I can see that most of the queries or mutations that I require are already present in the authAdadpter.ts file, so I was wondering how can I use it in my applicaiton?
I try to call it, but I am presented with this error.
I understand that createUser
mutation is wrapped with a custom mutation in authAdapter.ts which requires a secret key (CONVEX_AUTH_SECRET_KEY) , but how can I pass that exactly?
/authAdapter.ts
6 replies
CCConvex Community
•Created by Rayy on 5/19/2024 in #support-community
What is the difference between preloading query vs fetching queries in server components?
I have a parent component in Next JS which is a server component, that is rendering two children components both of which are client components. I need to access the query in both the client components.
After going through the docs, I can see there are two approaches to get this done.
1. Preloading the query and then accessing the preloaded query in the client componens.
2. fetching the query using
fetchQuery
in server component and passing the data to the client components.
Also, will preloading the query and then accessing it using usePreloadedQuery
call the query twice?
What does it mean when it says that it will not be reactive when using fetchQuery
?3 replies
CCConvex Community
•Created by Rayy on 3/2/2024 in #support-community
How to get results from paginate Queries?
I want to paginate the results of my query, I was unable to find any examples in the docs so can someone please help me with it?
The query I want to paginate -
I want to get all the results of a specific chatId till we have reached the end, how can I get the results in here?
3 replies
CCConvex Community
•Created by Rayy on 2/28/2024 in #support-community
How to handle errors in scheduled functions and display that error to the frontend?
Suppose I have a mutation which is called from the client which inserts data to a table.
It then calls a scheduled function which creates chunks from the youtube url.
After creating the chunks, another scheduled function is called which generates the embeddings from the chunks and then adds it to the vector database and updates the "chatbook" table saying that the embeddings has been generated.
Till the embeddings is being generating, a loading spinner is displayed in the frontend. And as soon as the table updates that the embedding has been generated, the chatbot is shown.
So, the problem I am facing is if there is an error in the
createChunks
action even then the loading spinner is being displayed in the frontend. The error is being caught but I cannot figure out how can I show that error to the frontend. What would be the efficient way to handle and display errors in such cases?
If I am unable to explain my situation, then please feel free to further ask any questions regarding the same.13 replies
CCConvex Community
•Created by Rayy on 2/16/2024 in #support-community
Is there a way to run mutations in bulk?
I am trying to create embeddings from chunk and then store those embedding in the convex vector store.
But rather than calling one mutation for each embedding response, is there a way I can add them in bulk?
I am trying to minimize
addEmbedding
calls.
4 replies
CCConvex Community
•Created by Rayy on 2/15/2024 in #support-community
Exceeded monthly free plan resource
3 replies
CCConvex Community
•Created by Rayy on 2/5/2024 in #support-community
What is the best approach to call query when they depend on scheduled functions?
I am calling
useMutation
from client where it inserts data in the db for that particular chat Id, and then run certain scheduled functions based on the data, and I am returning the chat Id to the client when the data has been inserted to the db.
My application is working fine, but I feel like I am making unnecessary query requests, when all the scheduled functions have not yet been completed.
I am currently showing a loading state to the user till the embeddingId is undeifned, since the last scheduled function will populate the embeddingId.
Is this okay? Or is there a better way to achieve this?
Here is my code for inserting data to the db and calling the scheuled functions
The scheduled function is dependant on other scheduled functions.11 replies
CCConvex Community
•Created by Rayy on 1/29/2024 in #support-community
Is there a way around to call actions from non functional components?
I am trying to build a chatbot with Vercel AI Sdk for streaming the response from OpenAI.
I was wondering if there is a way to call actions in my route.ts? I do not want to call the action unless my POST function is called, so
(In my action, I am doing vector search)
And also I was thinking to move this from
route.ts
to httpAction
and then use that to do the vector search, but will it be efficient? Another reason to refrain from using httpAction
is that it will be exposed and it just doesn't make any sense to use it like that.9 replies
CCConvex Community
•Created by Rayy on 1/29/2024 in #support-community
How to empty an optional field in the table?
This is my schema and I want to empty the chat field when this mutation is called.
I cannot initialise null to it since I am getting validation error, so how can I achieve this?
7 replies
CCConvex Community
•Created by Rayy on 1/20/2024 in #support-community
Error while trying to import third party libraries.
I have no idea why am I getting this error
when trying to import the below libraries
I am already using the "use node" declarative as mentioned in the docs.
5 replies
CCConvex Community
•Created by Rayy on 1/15/2024 in #support-community
How can I define dynamic keys for nested objects in schema?
This is my object, I want the property key to be dynamic of type string, how can I achieve the same in Convex?
The
yourAnswer
object will have this value
3 replies
CCConvex Community
•Created by Rayy on 9/17/2023 in #support-community
Unable to setup pinecone with convex
Why am I getting this error, when trying to setup Pinecone under a lib folder in my convex.
Error:
This is how I am setting up my pinecone.
5 replies