Matt Luo
Matt Luo
CCConvex Community
Created by Matt Luo on 12/6/2024 in #support-community
Docs feedback: CLERK_SECRET_KEY is not findable
This critical (edit: I'm not actually sure which scenarios it is required) environment variable, CLERK_SECRET_KEY, is not in plain text, so therefore not findable in documentation. It is burned into an image on https://docs.convex.dev/auth/clerk
8 replies
CCConvex Community
Created by Matt Luo on 11/17/2024 in #support-community
Does Vercel charge bandwidth for Convex images?
My team’s building a messaging aspect to our Next.js app and this question came up: We’re pretty confident that Vercel bandwidth is charged for images in the /next directory. These are images distributed throughout the Vercel CDN. But do images in convex (file storage) get charged for Vercel bandwidth when displayed on the front end?
4 replies
CCConvex Community
Created by Matt Luo on 9/5/2024 in #support-community
Bug: Console missing CONVEX_DEPLOY_KEY
No description
8 replies
CCConvex Community
Created by Matt Luo on 9/4/2024 in #support-community
YouTube video watch party design
I have a use case of integrating with the YouTube player iframe API, so that there can be a watch party of multiple users watching the same YouTube video (w/ the video playing at the playing time for all watchers). How would I design a situation like this? What I'm currently thinking is writing the currentPlayingTime to the Convex database every time someone clicks somewhere on the playing bar. Alternatively, I could choose some repeating write logic, e.g. write the current playtime every second or so, but that would cause the video to have a skipping effect since YouTube API can only play to the nearest second.
1 replies
CCConvex Community
Created by Matt Luo on 8/13/2024 in #support-community
Do geographically distant developers experience different errors?
No description
18 replies
CCConvex Community
Created by Matt Luo on 8/7/2024 in #support-community
Convex Ents: inconsistent singularization of field names
In Convex Ents many-to-many relationships, I noticed that Convex Ents generates field names that use tables names themselves, as opposed to the singular forms of those table names. This behavior is inconsistent with the one-to-one and one-to-many relationships, which generate fields using the singular form of table names. Let's take the example in https://labs.convex.dev/convex-ents/schema#manymany-edges. Here, I think Convex Ents generates field names in the messages_to_assignedTags junction table as tagsId and messagesId. If Convex Ents were consistent with one-to-many relationships, the generated fields would be tagId and messageId. 1) What is the expected behavior of Convex Ents? 2) My table names have a plural form, e.g. messages. To best use Convex Ents now and in the future, should the fields in junction tables use the singular or plural form of table names? i.e. messageId or messagesId?
2 replies
CCConvex Community
Created by Matt Luo on 8/6/2024 in #support-community
Convex Ents: how to express optional reference in 1 to many relationship?
From this documentation https://labs.convex.dev/convex-ents/schema, I'm trying to figure out a common use case, how to express zero-or-many? Looking at the documentation's example, how can I express that a user can have zero or many messages?
defineEntSchema({
users: defineEnt({
name: v.string(),
}).edges("messages", { ref: true }),
messages: defineEnt({
text: v.string(),
}).edge("user"),
});
defineEntSchema({
users: defineEnt({
name: v.string(),
}).edges("messages", { ref: true }),
messages: defineEnt({
text: v.string(),
}).edge("user"),
});
30 replies
CCConvex Community
Created by Matt Luo on 8/6/2024 in #support-community
Convex Ents: when defining m:m relationships, must the junction table have its own defineEnt()
when defining many to many relationships using Convex Ents, must the junction table have its own defineEnt()? - If I don't give the junction table its own defineEnt, then I get an error in npx convex dev like: Argument of type 'myJunctionTable"' is not assignable to parameter of type 'TableNamesInDataModel<EntDataModelFromSchema<SchemaDefinition<{ If I do provide a defineEnt() for the junction table, then I will get the error: 400 Bad Request: FieldsNotUniqueWithinIndex: Hit an error while evaluating your schema: In table "directMessageChannelMembers": In index "directMessageChannelId": Duplicate field "directMessageChannelId". Index fields must be unique within an index. If I don't specify the field name in the edges() function, then Convex Ents will use my table name (which is in plural form) to generate the field names. That may be a separate issue, reported here: https://discord.com/channels/1019350475847499849/1270846055017353328 - Also, if I need to add more columns to the junction table beyond the foreign keys, then it seems I need to give the junction table its own defineEnt()
5 replies
CCConvex Community
Created by Matt Luo on 8/5/2024 in #support-community
Does defineEntSchema have a way to set strictTableNameTypes: false ?
In the process of converting my schema.ts to use Convex Ents, I am getting an npx convex dev error for a table I had not previously defined in defineSchema(): Argument of type '"tableName"' is not assignable to parameter of type 'TableNamesInDataModel Adding strictTableNameTypes: false to my defineEntSchema() causes problems in functions.ts:
Argument of type 'EntDataModelFromSchema<SchemaDefinition<{ users: EntDefinition<VObject<{ name: string; tokenIdentifier: string; }, { name: VString<string, "required">; tokenIdentifier: VString<string, "required">; FieldName: VString<string, "required">; }, "required", "name" | "tokenIdentifier">, { ...; }, {}, {}, { ...; } & ... 6 ...' is not assignable to parameter of type 'GenericEntsDataModel'.
Type 'EntDataModelFromSchema<SchemaDefinition<{ users: EntDefinition<VObject<{ name: string; tokenIdentifier: string; }, { name: VString<string, "required">; tokenIdentifier: VString<string, "required">; FieldName: VString<string, "required">; }, "required", "name" | "tokenIdentifier">, { ...; }, {}, {}, { ...; } & ... 6 ...' is not assignable to type 'Record<string, GenericEntModel>'.
'string' index signatures are incompatible.
Property 'edges' is missing in type '{ document: any; fieldPaths: string; indexes: {}; searchIndexes: {}; vectorIndexes: {}; }' but required in type 'GenericEntModel'.
Argument of type 'EntDataModelFromSchema<SchemaDefinition<{ users: EntDefinition<VObject<{ name: string; tokenIdentifier: string; }, { name: VString<string, "required">; tokenIdentifier: VString<string, "required">; FieldName: VString<string, "required">; }, "required", "name" | "tokenIdentifier">, { ...; }, {}, {}, { ...; } & ... 6 ...' is not assignable to parameter of type 'GenericEntsDataModel'.
Type 'EntDataModelFromSchema<SchemaDefinition<{ users: EntDefinition<VObject<{ name: string; tokenIdentifier: string; }, { name: VString<string, "required">; tokenIdentifier: VString<string, "required">; FieldName: VString<string, "required">; }, "required", "name" | "tokenIdentifier">, { ...; }, {}, {}, { ...; } & ... 6 ...' is not assignable to type 'Record<string, GenericEntModel>'.
'string' index signatures are incompatible.
Property 'edges' is missing in type '{ document: any; fieldPaths: string; indexes: {}; searchIndexes: {}; vectorIndexes: {}; }' but required in type 'GenericEntModel'.
1 replies
CCConvex Community
Created by Matt Luo on 7/31/2024 in #support-community
Export of Convex Ents documentation
Is it possible to export the Convex Ents documentation into a single file? https://labs.convex.dev/convex-ents
16 replies
CCConvex Community
Created by Matt Luo on 7/31/2024 in #support-community
Are there example repos using Convex Ents?
Are there open source or example repos using Convex Ents? I didn't get any search results from the GitHub search bar in the get-convex org. https://github.com/search?q=org%3Aget-convex%20defineEntSchema&type=code
23 replies
CCConvex Community
Created by Matt Luo on 7/28/2024 in #support-community
Which identifier generator library to use for message channel and threads?
1) I am building a Discord-like messaging experience. For servers, channel, threads, etc. it appears that Discord uses Snowflake IDs, 18-integer long numeric values. What would you recommend for a Convex project? It seems that for a single Convex project, IDs that are unique over distributed database nodes is not important, but sort-ability and query performance are important.
If I wanted to keep my programming efforts really simple, I could simply use a _id field values themselves, but 32-characters is a lot of characters to put in URLs, especially when multiple resources are involved. 2) Likewise, what would you recommend for a user profile external identifier? Looks like LinkedIn appends a 8-character long suffix that uses a combination of all-lowercase letters and numbers.
12 replies
CCConvex Community
Created by Matt Luo on 7/26/2024 in #support-community
How do you get the issuer for a new user account from Clerk webhooks?
I followed this documentation: https://docs.convex.dev/auth/database-auth#set-up-webhooks and was able to use a Clerk webhook in order to automatically insert a document in users Convex table. But, I'm trying to adhere to the pattern where the users table has a tokenIdentifier column. The problem is that I don't see a way to get the issuer value from the Clerk webhook.
20 replies
CCConvex Community
Created by Matt Luo on 7/26/2024 in #support-community
Database filter operator, contains
Does Convex dashboard have a database column filter operator, contains?
9 replies
CCConvex Community
Created by Matt Luo on 7/25/2024 in #support-community
Convex Ents documentation: code comment // You can now use ctx.table as well:
In this messages.ts code example https://labs.convex.dev/convex-ents/setup/existing#setup-custom-functions There is a code comment that says // You can now use ctx.table as well: Is that "as well" statement actually true? My interpretation of the Convex Ents docs is that using Convex Ents is an all-or-nothing commitment: - The developer totally replaces defineEntSchema() with defineSchema(), and doesn't use defineSchema() at all for the foreseeable future - A project that uses Convex Ents does not use this import statement at all: import { mutation, query } from "./_generated/server"; And so should not be using ctx.db.query() Is this interpretation correct?
11 replies
CCConvex Community
Created by Matt Luo on 7/22/2024 in #support-community
How does the search bar in https://www.convex.dev/can-do work?
No description
10 replies
CCConvex Community
Created by Matt Luo on 7/21/2024 in #support-community
Can Convex Auth be a OAuth 2 Provider for other apps?
If my Next.js app uses Convex Auth, can that app, in turn, become a OAuth 2 Provider for other apps? Seems like Convex Auth cannot, based on my research on Auth.js. As a reference, this is the use case I'm referring to if the app were to use Clerk: https://clerk.com/docs/advanced-usage/clerk-idp
4 replies
CCConvex Community
Created by Matt Luo on 7/10/2024 in #support-community
How to store long lists in Convex DB, i.e. a user's known foreign words?
My app has an aspect of reading comprehension assistance for foreign languages. It shows word-level translations for foreign language text. My app shouldn't show a translation for a given foreign word if a user already knows it. I am trying to store a user's "known words" for a given language. That list can get pretty long: a typical American 8th grader would know ~25,000 English words. Looking at the documentation, there's some database limits that I don't know how to accommodate: 1) Number of documents scanned in a query: 16,384 2) The column data type, Arrays, can have at most 8192 values. 3) The column data type, Objects can have at most 1024 entries.
7 replies
CCConvex Community
Created by Matt Luo on 7/10/2024 in #support-community
Conflicting documentation: Does Convex Auth work for React Native?
This page https://docs.convex.dev/auth/convex-auth says: We're working on supporting authentication for Next.js server-side and on OAuth for React Native. But this page https://labs.convex.dev/auth/setup has a React Native section for Set up the React provider
2 replies
CCConvex Community
Created by Matt Luo on 7/9/2024 in #support-community
How do I deploy a change for a table name?
In the scenario where a table already has data in it, How do I deploy a change for a table name? When I change the name of the table in my schema.ts, when I insert a new document, Convex is creating an entirely new table with the new name. The old table with the old name remains. Kapa says "To rename a table, you would need to create a new table with the new name, migrate all the data from the old table to the new one, and then delete the old table." https://discord.com/channels/1019350475847499849/1260308690490097664
17 replies