yarrichar
yarrichar
CCConvex Community
Created by yarrichar on 10/6/2024 in #support-community
Is there a way to control the websocket reconnect backoff?
Basically I want to cap the reconnect time to 10seconds. I was just doing some local testing and very quickly went over 20 seconds:
Attempting reconnect in 22248.468971814553ms
Attempting reconnect in 22248.468971814553ms
Any help greatly appreciated.
18 replies
CCConvex Community
Created by yarrichar on 8/12/2024 in #support-community
When does a mutation commit?
I assume this is a silly question, but I'm just wanting to check that if I call a mutation from an action that the mutation will have succeeded or failed when the mutation call returns? I'm basically wanting to do:
actionA:
runMutation(lockRecord);
try {
// do stuff while I'm holding the lock
} finally {
runMutation(releaseRecord);
}
actionA:
runMutation(lockRecord);
try {
// do stuff while I'm holding the lock
} finally {
runMutation(releaseRecord);
}
Just asking because queries and mutations are deterministic, and the talk in the docs about it being safe to retry them.
3 replies
CCConvex Community
Created by yarrichar on 4/21/2024 in #support-community
intellisense not working
I'm using intellij (although this also seemed to be true in VSCode), and intellisense on my latest project doesn't seem to be working for convex functions (e.g. I can't ctrl click on api.x.y to jump to definition). Intellisense works fine for none convex typescript types. The confusing thing is that it is working for another project of mine. The only difference I can see is the convex version 1.11.0 vs 1.3.1. Downgrading didn't seem to help though. Are there any other settings I should be taking a look at? Thanks!
5 replies
CCConvex Community
Created by yarrichar on 2/19/2024 in #support-community
Storing openai embeddings "length limit exceeded"
I'm generating OpenAI embeddings in an action, and when I try and pass them to a mutation for saving I run into:
{"code":"BadJsonBody","message":"Failed to buffer the request body: length limit exceeded"}
{"code":"BadJsonBody","message":"Failed to buffer the request body: length limit exceeded"}
I'm assuming my only option is to pass them to the mutation in batches? Hoping to avoid that, since it's not ideal from a transactional point of view. In terms of the quantity I'm trying to pass to the mutation - it's just 100 vectors, and the original text which is approx 69k characters long.
10 replies
CCConvex Community
Created by yarrichar on 10/10/2023 in #support-community
Multiple vector indexes on the same table
I have a bunch of embeddings stored in a table. I want to be able to filter those on different columns depending on the scenario. I assume I'm meant to create two different vectorIndex's. But I keep getting the error when I try:
400 Bad Request: IndexFieldsNotUnique: Hit an error while evaluating your schema:
Index fields must be unique within an index.
400 Bad Request: IndexFieldsNotUnique: Hit an error while evaluating your schema:
Index fields must be unique within an index.
The indexes I have on that table are:
.vectorIndex("by_embedding", {
vectorField: "embedding",
dimensions: 1536,
filterFields: ["clerkUserId"],
})
.vectorIndex("by_embedding_doc", {
vectorField: "embedding",
dimensions: 1536,
filterFields: ["documentId"],
}),
.vectorIndex("by_embedding", {
vectorField: "embedding",
dimensions: 1536,
filterFields: ["clerkUserId"],
})
.vectorIndex("by_embedding_doc", {
vectorField: "embedding",
dimensions: 1536,
filterFields: ["documentId"],
}),
If I remove the second vectorIndex then it works. Any ideas what I'm doing wrong?
10 replies
CCConvex Community
Created by yarrichar on 9/28/2023 in #support-community
Error: Connection lost while action was in flight
I've just started to get the following error:
logging.js:39 Uncaught (in promise) Error: [CONVEX A(analytics:summary)] Connection lost while action was in flight
at createError (logging.js:39:1)
at BaseConvexClient.action (client.js:297:24)
logging.js:39 Uncaught (in promise) Error: [CONVEX A(analytics:summary)] Connection lost while action was in flight
at createError (logging.js:39:1)
at BaseConvexClient.action (client.js:297:24)
Not sure what's causing it. Pretty sure I'm doing the right thing. Functions say they're ready / deployed ok. React code:
const fetchSummary = useAction(api.analytics2.analyticsSummary);

useEffect(() => {
fetchSummary({ mvpId: mvpId as Id<"mvp">, minDate: moment().subtract(24, "hours").date() })
.then(result => {
console.log("Analytics result: ", result);
});
}, []);
const fetchSummary = useAction(api.analytics2.analyticsSummary);

useEffect(() => {
fetchSummary({ mvpId: mvpId as Id<"mvp">, minDate: moment().subtract(24, "hours").date() })
.then(result => {
console.log("Analytics result: ", result);
});
}, []);
Convex code:
export const analyticsSummary = action({
args: { mvpId: v.id("mvp"), minDate: v.number() },
handler: async ({ auth, runQuery }, { mvpId, minDate }) => {
return null;
}
});
export const analyticsSummary = action({
args: { mvpId: v.id("mvp"), minDate: v.number() },
handler: async ({ auth, runQuery }, { mvpId, minDate }) => {
return null;
}
});
23 replies
CCConvex Community
Created by yarrichar on 8/12/2023 in #support-community
langchain - can't find import when doing: npm run build
I'm using langchain in one of my actions, and it works fine for local dev (i.e. when running npm run dev, but when I try and do a build with npm run build I get the following error:
- info Linting and checking validity of types ..Failed to compile.

./convex/util/pineconeUtil.ts:4:28
Type error: Cannot find module 'langchain/document_loaders' or its corresponding type declarations.

2 |
3 | import { PineconeClient } from "@pinecone-database/pinecone";
> 4 | import { TextLoader } from "langchain/document_loaders";
| ^
5 | import { OpenAIEmbeddings } from "langchain/embeddings";
6 | import { Blob } from "buffer";
7 | import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
- info Linting and checking validity of types ..Failed to compile.

./convex/util/pineconeUtil.ts:4:28
Type error: Cannot find module 'langchain/document_loaders' or its corresponding type declarations.

2 |
3 | import { PineconeClient } from "@pinecone-database/pinecone";
> 4 | import { TextLoader } from "langchain/document_loaders";
| ^
5 | import { OpenAIEmbeddings } from "langchain/embeddings";
6 | import { Blob } from "buffer";
7 | import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
The first line of that file is "use node". Any ideas on what I'm doing wrong / what the difference is between npm run dev and npm run build ? Thanks!
14 replies
CCConvex Community
Created by yarrichar on 8/9/2023 in #support-community
Database - Best way to model tags associated with an entity
I am storing a bunch of articles, each of which I want to store some tags against. I then want to be able to query for articles associated with one or more tags. I've seen the join example under https://docs.convex.dev/database/reading-data#more-complex-queries but it doesn't seem like it will work well here. For example if I have two tables: - article - article_tag If I want to find articles that have tagA and tagB it seems like I would want to do something like: fetch article_tag entries matching tagA for each of those, X, fetch article_tag matching X.articleId and tagB fetch all those results, Y, fetch articles matching Y.articleId sort and return the first page Hopefully I'm missing something 🙂
13 replies
CCConvex Community
Created by yarrichar on 7/17/2023 in #support-community
Unique database fields
Is it possible to create a unique constraint / index in Convex? Similar to what you'd find in a standard RDBMS.
48 replies
CCConvex Community
Created by yarrichar on 7/15/2023 in #support-community
Add function dependencies
I'm wanting to make use of a 3rd part library in an internalAction - is this possible, and if so where do I specify it? I assume not in the root level package.json for my project since that has all my web app dependencies. My project setup is very simple atm - I've basically followed the nextjs (pages dir) quickstart guide.
9 replies