mikeysee
mikeysee
CCConvex Community
Created by mikeysee on 9/2/2024 in #support-community
Is there a cached query version of usePagniatedQuery?
Convex helpers has a cached version of useQuery (https://github.com/get-convex/convex-helpers/blob/main/packages/convex-helpers/README.md#query-caching) but is there a version that works with paginated queries?
5 replies
CCConvex Community
Created by mikeysee on 8/24/2024 in #support-community
Convex auth seems to sign me out every 24-28 hours, why?
I cant for the life of me work it out. This is my auth setup:
import { convexAuth } from "@convex-dev/auth/server";
import { Password } from "@convex-dev/auth/providers/Password";

export const { auth, signIn, signOut, store } = convexAuth({
providers: [Password],
});
import { convexAuth } from "@convex-dev/auth/server";
import { Password } from "@convex-dev/auth/providers/Password";

export const { auth, signIn, signOut, store } = convexAuth({
providers: [Password],
});
So im not doing anything special there.. the docs say the session length should default to 30 days not 1-2 days. Im using the Authenticated, AuthLoading, Unauthenticated from "convex/react" The project is using Vite. My convex provider looks like:
import { ConvexReactClient } from "convex/react";
import { ReactNode, useMemo } from "react";
import { ConvexAuthProvider } from "@convex-dev/auth/react";
import { ConvexQueryCacheProvider } from "convex-helpers/react/cache/provider";

export function ConvexClientProvider({ children, url }: { children: ReactNode; url: string }) {
const client = useMemo(() => {
console.log(`Creating ConvexReactClient with url: ${url}`);
return new ConvexReactClient(url);
}, [url]);

return (
<ConvexAuthProvider client={client}>
<ConvexQueryCacheProvider>{children}</ConvexQueryCacheProvider>
</ConvexAuthProvider>
);
}
import { ConvexReactClient } from "convex/react";
import { ReactNode, useMemo } from "react";
import { ConvexAuthProvider } from "@convex-dev/auth/react";
import { ConvexQueryCacheProvider } from "convex-helpers/react/cache/provider";

export function ConvexClientProvider({ children, url }: { children: ReactNode; url: string }) {
const client = useMemo(() => {
console.log(`Creating ConvexReactClient with url: ${url}`);
return new ConvexReactClient(url);
}, [url]);

return (
<ConvexAuthProvider client={client}>
<ConvexQueryCacheProvider>{children}</ConvexQueryCacheProvider>
</ConvexAuthProvider>
);
}
The versions I am using are:
"convex": "^1.14.4",
"@convex-dev/auth": "^0.0.61",
"convex": "^1.14.4",
"@convex-dev/auth": "^0.0.61",
Im on windows 11 running chrome if that helps
2 replies
CCConvex Community
Created by mikeysee on 8/6/2024 in #support-community
Faster websocket connection? Or skip websocket connection?
I am building a chrome extension that saves the given page to a convex DB. When I press the browser action button it takes a second to load before it saves the page. The issue is the time it takes to connected the websocket for me here in Western Australia. If I use the HTTP client its lightning quick. Is there a way I can either speed up the websocket connection or perhaps access the auth token after the initial sign-in then use that for subsequent http calls?
7 replies
CCConvex Community
Created by mikeysee on 7/31/2024 in #support-community
GET /.well-known/openid-configuration is 404'ing with Convex Auth
No description
3 replies
CCConvex Community
Created by mikeysee on 5/28/2024 in #support-community
Runtime validation using Convex Types
I asked the AI this but the answer wast very helpful unfortunately. Is there a way I can validate a type given a convex value so for example if I have:
const userValidator = v.object({
name: v.string(),
});
const userValidator = v.object({
name: v.string(),
});
I would like to validate that this:
validate(userValidator, { name: 123 })
validate(userValidator, { name: 123 })
Would throw an error because name is not of type string
9 replies
CCConvex Community
Created by mikeysee on 2/23/2024 in #support-community
Filtering issues on the dashboard
No description
4 replies
CCConvex Community
Created by mikeysee on 1/17/2024 in #support-community
Error while trying to use Loro CRDTs (Uncaught ReferenceError: FinalizationRegistry is not defined)
Hey guys im trying some experiments with Loro and Convext together (https://www.loro.dev/docs/tutorial/get_started) but am running into an issue. Here is a basic query I am trying to write:
export const myQuery = query({
args: {},
handler: async (ctx, args) => {
const doc = new Loro();
doc.getList("mylist").insert(0, "A");
return doc.exportSnapshot();
},
});
export const myQuery = query({
args: {},
handler: async (ctx, args) => {
const doc = new Loro();
doc.getList("mylist").insert(0, "A");
return doc.exportSnapshot();
},
});
The error I get is:
✖ Error: Unable to push deployment config to https://kindly-elephant-254.convex.cloud
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze auth.js: Uncaught ReferenceError: FinalizationRegistry is not defined
at <anonymous> (../node_modules/loro-wasm/bundler/loro_wasm_bg.js:209:9)
✖ Error: Unable to push deployment config to https://kindly-elephant-254.convex.cloud
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze auth.js: Uncaught ReferenceError: FinalizationRegistry is not defined
at <anonymous> (../node_modules/loro-wasm/bundler/loro_wasm_bg.js:209:9)
I suspect the issue is because loro uses wasm. I have read however that WASM is supported in both runtimes. Is this not correct?
46 replies
CCConvex Community
Created by mikeysee on 1/9/2024 in #support-community
Yarn dropdown on docs?
Just a small suggestion not support request (maybe you should have a tag or even new forum category for these). Would love to see an optional yarn version of the docs such as this page: https://docs.convex.dev/quickstart/react. I have seen other projects either offer two options side by side or offer a side-wide toggle that lets you choose what your favourite package manager is (npm, pnpm, yarn etc)
5 replies
CCConvex Community
Created by mikeysee on 9/29/2023 in #support-community
Convex and State Machines
Hi, has anyone done anything specifically with state machines on convex? Im thinking it might be quite powerful tro leverage XState (or something similar) plus the jobs system plus the natural atomicity of Convex to have a system follow a fixed state chart?
15 replies
CCConvex Community
Created by mikeysee on 9/26/2023 in #support-community
More complex indexes
It would be awesome if at some point Convex could support PostgresJSON-like index's so we could index deeply within objects. Im thinking something like the following:
defineSchema({
users: defineTable({
name: v.string(),
email: v.string(),
status: v.union(
v.object({
kind: v.literal("not_verified"),
createdAt: v.number(),
}),
v.object({
kind: v.literal("verified"),
createdAt: v.number(),
}),
),
})
.index("by_status_kind", o => o.status.kind)
});
defineSchema({
users: defineTable({
name: v.string(),
email: v.string(),
status: v.union(
v.object({
kind: v.literal("not_verified"),
createdAt: v.number(),
}),
v.object({
kind: v.literal("verified"),
createdAt: v.number(),
}),
),
})
.index("by_status_kind", o => o.status.kind)
});
4 replies
CCConvex Community
Created by mikeysee on 9/17/2023 in #support-community
db.get vs db.find
I know its probably a bit late now as its likely the API is now fixed but a convention I really like is "get" means the thing you are looking for MUST be there whereas "find" could return the thing OR undefined. So in this case it would have been great if we had both db.get AND db.find where the latter is basically what db.get currently is and the new db.get throws an error if it cant find the entry. Alternative you could do the Prisma route with its orThrow convention to have something like db.getOrThrow. Anyways, I just thought I would put it out there 🙂
2 replies
CCConvex Community
Created by mikeysee on 9/16/2023 in #support-community
How would you structure this schema?
I have the following schema:
export default defineSchema({
users: defineTable({
name: v.string(),
pictureUrl: v.union(v.string(), v.null()),
tokenIdentifier: v.string(),
}).index("by_token", ["tokenIdentifier"]),

canvases: defineTable({
svgDocument: v.string(),
members: v.array(
v.object({
userId: v.id("users"),
role: v.union(v.literal("owner"), v.literal("editor")),
}),
),
}).index("by_authorUserId", ["authorUserId"]), // want to be able to get canvases by authorUserId but I cant do that with this index
});
export default defineSchema({
users: defineTable({
name: v.string(),
pictureUrl: v.union(v.string(), v.null()),
tokenIdentifier: v.string(),
}).index("by_token", ["tokenIdentifier"]),

canvases: defineTable({
svgDocument: v.string(),
members: v.array(
v.object({
userId: v.id("users"),
role: v.union(v.literal("owner"), v.literal("editor")),
}),
),
}).index("by_authorUserId", ["authorUserId"]), // want to be able to get canvases by authorUserId but I cant do that with this index
});
Note I want to be able to list all the canvases that a user is a member of but I cant. Im guessing I have to reverse this structure and have a "canvasMembers" table that records the userId and canvasId and then index and query that first then join to get the canvases? Just checking incase there is a better way.
7 replies
CCConvex Community
Created by mikeysee on 9/15/2023 in #support-community
Out of Date Docs / Stack Links
Hey guys, im just working on a little project for https://hackathon.webdevcody.com/ and noticed that there are quite a lot of broken links and bad information in the docs for convex. It makes it really hard for new people to come in and understand why things arent working. I suggest going through all your docs regularly to make sure that all the examples work, are up to date with the latest convex APIs and third party APIs. If you want specific examples ill list them here as I find them. First one is, your AI page (https://docs.convex.dev/ai) links to building a fullstack ChatGPT app (https://stack.convex.dev/full-stack-chatgpt-app) and that article gives an outdated way on how to configure the OpenAI sdk.. its also written in JS not TS (BTW this is an inconsistency that is all over Convex).
9 replies
CCConvex Community
Created by mikeysee on 8/4/2023 in #support-community
Team Usage Metrics
No description
4 replies
CCConvex Community
Created by mikeysee on 8/4/2023 in #support-community
"Built With Convex" section?
Im not sure if you have this already somewhere but it might be nice to have a "built with convex" section on your site or here in discord where users can show the things they are building. For example I built a twitter clone: https://threadx-app.netlify.app/ (https://github.com/mikecann/ThreadX) And did a writeup on it here: https://mikecann.co.uk/posts/tinkering-with-convex
5 replies
CCConvex Community
Created by mikeysee on 7/27/2023 in #support-community
Move Project to Different Team
Is there a way currently to move a project to a different team?
3 replies
CCConvex Community
Created by mikeysee on 7/27/2023 in #support-community
Docs on Testing
No description
3 replies
CCConvex Community
Created by mikeysee on 7/24/2023 in #support-community
Thoughts on the new pricing
I just saw the new pricing announcement (BTW you should start a thread with each announcement so we can comment on it directly) and had some thoughts. I always wondered about the "execution cost" of my operations and how that would affect not just my cost but also you guys. Before you didnt tie how I write my code to the cost of running it. So effectively the incentive for writing high-performance code (using indexes and whatnot) wasnt there, now it is because it contributues to my quota. So in general I think this is a good thing as it incentivizes you to code in a more efficient manner. Now what I think is missing from Convex to complete the circle is better tooling to estimate and analyze the performance of your queries, mutations and actions. The graphs that you give on the dashboard are nice but I think there's a lot more that can be done to help here. For example; a big issue I have with Postgres and other databases is that my queries work great locally when I only have a few tens of records in my database but as soon as it hits production then that JOIN or AGGREGATE that you did suddenly grinds things to a halt. Or worse it starts slowing down over time and unless you have some APM hooked up like Elastic then you wont know that. Setting up and understanding Elastic is non-trivial so I think there is definately a lot of room here for Convex to do what you have done for application development but for application monitoring. I want to know if my queries or mutations slow down over time and why they might be slow (ANALYZE EXPLAIN). I want to be emailed / notified when response times are above 100ms for example. Overall I think the new pricing is fair and good but IMO it would be good to provide further tooling in the future to allow us to know WHY some operations are slow and expensive and if they change over time. Cheers, keep up all the hard work!
16 replies