Gorka Cesium
Gorka Cesium
CCConvex Community
Created by Gorka Cesium on 9/26/2024 in #support-community
How to assign types created with convex/values to function parameters?
I want to create a utility function but need to pass an argument that has type safety. How can I reuse the type from a convex/values into a normal function? Example schema.ts
export const cut = v.union(v.literal("Rect"), v.literal("Curve");


export default defineSchema({
things: defineTable({
cut: cut
})
})
export const cut = v.union(v.literal("Rect"), v.literal("Curve");


export default defineSchema({
things: defineTable({
cut: cut
})
})
Here I have my utility function. I can use some hacks around it but the compiler won't know when the cut definition changed. utils.ts
export let cutToText = (cut: any) => {
return cut === "Rect" ? "Rectangle": cut === "Curve" ? "Curvy" : ""
}
export let cutToText = (cut: any) => {
return cut === "Rect" ? "Rectangle": cut === "Curve" ? "Curvy" : ""
}
8 replies
CCConvex Community
Created by Gorka Cesium on 5/13/2024 in #support-community
recursive type
I'm trying to declare a dynamic tree structure for layouts (similar to HTML). Is it possible to have a recursive type? I'm trying this
let element_eurofutur = v.union(v.literal("Row"), v.literal("Col"), v.literal("Hoja"), v.literal("Fijo"), v.literal("Poste") );

let node_eurofutur = v.object({
element: element_eurofutur,
children: v.array(node_eurofutur)
});
let element_eurofutur = v.union(v.literal("Row"), v.literal("Col"), v.literal("Hoja"), v.literal("Fijo"), v.literal("Poste") );

let node_eurofutur = v.object({
element: element_eurofutur,
children: v.array(node_eurofutur)
});
but getting error
Block-scoped variable 'node_eurofutur' used before its declaration.
7 replies
CCConvex Community
Created by Gorka Cesium on 4/14/2024 in #support-community
dayOfWeek is not documented
https://docs.convex.dev/api/classes/server.Crons#weekly I would like to know which are valid values for dayOfWeek in crons.weekly. Please add to docs
5 replies
CCConvex Community
Created by Gorka Cesium on 4/14/2024 in #support-community
weekly cron job: how to disable on Dev?
I would like to set a weekly cron job that sends an email once per week. But I would like this to happen only in production. Which is the recommended pattern for this? First comes to mind to use an env variable.
27 replies
CCConvex Community
Created by Gorka Cesium on 4/4/2024 in #support-community
intermitent failure Clerk: `const identity = await ctx.auth.getUserIdentity();`
Problem: the app works when page loads but if I reload it, the identity is null. In development I have two apps that share the same convex dev in the same monorepo. I run them one a a time in localhost:3000, so when i use one app i don't run the other one. This is the function that is throwing when getUserIdentity. It works fine on the first call, but fails after that.
// convex/page.ts
export const getPage = query({
args: { customerId: v.optional(v.id("bz_customers")) },
handler: async (ctx, { customerId }) => {
const identity = await ctx.auth.getUserIdentity(); // works the first time.
if (!identity) throw new Error("Identidad no encontrada"); // throws on subsequent calls (reload of page or changing the args values from the react component hook useQuery)

//...etc

// convex/page.ts
export const getPage = query({
args: { customerId: v.optional(v.id("bz_customers")) },
handler: async (ctx, { customerId }) => {
const identity = await ctx.auth.getUserIdentity(); // works the first time.
if (!identity) throw new Error("Identidad no encontrada"); // throws on subsequent calls (reload of page or changing the args values from the react component hook useQuery)

//...etc

Dependency: "convex": "^1.11.0", The auth is managed with Clerk. I set a JWT template for each app, with the same applicationID: "convex"
// auth.config.js
// Both env variables are set in dashboard.convex.dev
export default {
providers: [
{ applicationID: "convex", domain: process.env.CLERK_JWT_ISSUER_DOMAIN }, // fentex.com
{
applicationID: "convex",
domain: process.env.BREZZA_CLERK_JWT_ISSUER_DOMAIN, // brezza.com
},
],
};
// auth.config.js
// Both env variables are set in dashboard.convex.dev
export default {
providers: [
{ applicationID: "convex", domain: process.env.CLERK_JWT_ISSUER_DOMAIN }, // fentex.com
{
applicationID: "convex",
domain: process.env.BREZZA_CLERK_JWT_ISSUER_DOMAIN, // brezza.com
},
],
};
The other app works fine. it was the first one that i set up. The failure happens on the second app that I added. The apps are in different url domains. I wonder if it is a dirty state in the auth system. Any idea how can I debug this?
93 replies
CCConvex Community
Created by Gorka Cesium on 4/2/2024 in #support-community
Convex AI Bot not working
No description
6 replies
CCConvex Community
Created by Gorka Cesium on 3/30/2024 in #support-community
CLI Deploy to use project name
No description
2 replies
CCConvex Community
Created by Gorka Cesium on 3/26/2024 in #support-community
dashboard infinite page reload loop when filtering
No description
8 replies
CCConvex Community
Created by Gorka Cesium on 3/25/2024 in #support-community
Stack 5-dashboard-tricks: videos aren't loading in Safari
In this blog post the videos seem to be incompatible with Safari Browser https://stack.convex.dev/5-dashboard-tricks They work in Chrome
2 replies
CCConvex Community
Created by Gorka Cesium on 3/22/2024 in #support-community
Clerk with multiple domains
How could I set up auth in Convex + Clerk for apps that are in multiple web domains? for example: app 1 = bz.com app 2 = fx.com That means that env variable CLERK_JWT_ISSUER_DOMAIN will not work for both, right? Would I have to remove the ConvexProviderWithClerk from the Provider in react? I opened a git issue in the monorepo template. https://github.com/get-convex/turbo-expo-nextjs-clerk-convex-monorepo/issues/2
31 replies
CCConvex Community
Created by Gorka Cesium on 3/10/2024 in #support-community
is it possible to search by prefix only?
I need to search exact matches that start with a code. example search text : 13910 and expected results: - 13910-1 - 13910-2 Currently it gives the first results plus a bunch of other results with fuzzy search. In this case i would like to do a prefix search only. I was thinking about using filter but not sure how to achieve startsWith with filter
20 replies
CCConvex Community
Created by Gorka Cesium on 3/8/2024 in #support-community
failed to run CLI runMigration
No description
5 replies
CCConvex Community
Created by Gorka Cesium on 3/7/2024 in #support-community
Not valid JSON: EOF
No description
46 replies
CCConvex Community
Created by Gorka Cesium on 3/6/2024 in #support-community
convex dev hanging `InternalServerError`
No description
9 replies
CCConvex Community
Created by Gorka Cesium on 2/26/2024 in #support-community
which is the latest recommended way to migrate from FaunaDB to Convex?
I am migrating from Fauna tu Convex but need to see how to export data from Fauna and import it to Convex. Any advice is welcome
11 replies
CCConvex Community
Created by Gorka Cesium on 2/23/2024 in #support-community
how to delete the references in other tables to a deleted item?
If i delete a quoteItem, how can i delete also the other tables that are referencing this item ?
export const delete_ = mutation({
args: {
id: v.id('quoteItems'),
},
handler: async ({ db }, { id }) => {
// Validate arguments here. Throw error if invalid. Example `typeof city !== "string" ||`
if (typeof id !== 'string') {
throw new Error('Invalid argument')
}
// TODO how to clean other tables that reference this item?
return await db.delete(id)
},
})
export const delete_ = mutation({
args: {
id: v.id('quoteItems'),
},
handler: async ({ db }, { id }) => {
// Validate arguments here. Throw error if invalid. Example `typeof city !== "string" ||`
if (typeof id !== 'string') {
throw new Error('Invalid argument')
}
// TODO how to clean other tables that reference this item?
return await db.delete(id)
},
})
4 replies
CCConvex Community
Created by Gorka Cesium on 12/22/2023 in #support-community
fuzzy search is acting worse than previous search (convex v1.7.1)
In the screen recording it shows a list of the customer names. When I search a name the results just show one of the customers correctly. The rest are ignored. I wonder if it is an issue with the indexing.
7 replies
CCConvex Community
Created by Gorka Cesium on 10/27/2023 in #support-community
how to share a convex database between multiple repos?
I would like to share a convex database within two different projects. Each project in its own repo. How can I do this?
15 replies
CCConvex Community
Created by Gorka Cesium on 7/25/2023 in #support-community
ENOTFOUND provision.convex.dev
lately i've been seeing this error when running pnpm convex dev
Unexpected error when authorizing - are you connected to the internet?
Error: getaddrinfo ENOTFOUND provision.convex.dev
Unexpected error when authorizing - are you connected to the internet?
Error: getaddrinfo ENOTFOUND provision.convex.dev
I have to retry, sometimes multiple times, until it works again. I am connected to the internet because I can browse. Although maybe I have some intermitent signal that is causing this issue. I wonder why is this happening.
17 replies
CCConvex Community
Created by Gorka Cesium on 7/4/2023 in #support-community
patch nested object
items: defineTable(
v.object({
quote: v.id("quotes"),
tag: v.literal("ItemType1")
value: v.object({
name: v.string()
reference: v.string()
})
})
)
items: defineTable(
v.object({
quote: v.id("quotes"),
tag: v.literal("ItemType1")
value: v.object({
name: v.string()
reference: v.string()
})
})
)
how can I write a mutation to patch value without having to input all the fields? for example
patch(itemId, {value: {name:newName}})
patch(itemId, {value: {name:newName}})
23 replies