allen
CCConvex Community
•Created by allen on 7/20/2024 in #support-community
ctx.db.get() Always returning a Doc<'users'> typed doc
I have multiple queries for multiple documents structured like so:
The typed return of the
ctx.db.get
is a Doc<'users'>
instead of a Doc<'invites'>
(or the respective doc type to the provided arg type). If i inspect the type of the ID on the arg its showing as any
.
This problem emerged today after upgrade convex to latest and adding Convex Auth. This only seems to impact code where the ID is provided on query/mutation args.11 replies
CCConvex Community
•Created by allen on 7/19/2024 in #support-community
API types are "excessively deep" when Convex Auth is installed.
10 replies
CCConvex Community
•Created by allen on 2/13/2024 in #support-community
SendGrid Example?
I am trying the most basic SendGrid implementation in an action (which works fine in regular NodeJs env), but getting the following error, even though I'm not using SendGrids template substitutions.
Uncaught TypeError: Cannot read properties of undefined (reading 'substitutionWrappers')
The code is as follows:
Anyone have success integrating SendGrid in Convex?8 replies
CCConvex Community
•Created by allen on 2/12/2024 in #support-community
WebStorm File Cache Conflict on File Save
30 replies
CCConvex Community
•Created by allen on 1/4/2024 in #support-community
undefined < Number === true?
I have an optional
expiresAt
field in my schema that holds an expiration date for a record. If its undefined, it should never expire. I have an index on this field as I have a cron job running every minute to see what should be expired. That query looks like so:
However, this returns records that have an undefined value for the expiresAt
field, requiring me to filter these in memory with:
Being this runs so frequently, its eating through my db bandwidth, retrieving these unwanted rows.
Before I get cute with my schema to hack around this...
1) Is this the intended behavior of the query engine? It doesnt match javascript's behavior.
2) Is there a way to better structure or query my existing index to remove these results?17 replies
CCConvex Community
•Created by allen on 5/17/2023 in #support-community
Schedule 'signature'?
Has there been thought to dedupping scheduled calls at the
runAt
/runAfter
execution time of multiple invocations with the same name/args signature?
Eg: if I have a updateUser
mutation that schedules an action of doThing
with {userId}
as the args to runAfter 60 seconds, could additional schedules of the same signature be dedupped into this same schedule runner so that only one invocation happens per 60 seconds?6 replies
CCConvex Community
•Created by allen on 5/16/2023 in #support-community
Optimistic update from action?
I have an action that invokes a mutation. What is the best way to optimistically update the cache for the queries affected by the action-invoked mutation client side?
6 replies
CCConvex Community
•Created by allen on 5/10/2023 in #support-community
Optimistic Update on Paginated Query
Is there an example of an optimistic update on a paginated query? I'm unsure of how the
paginationOpts
are cache-keyed to make sure I can get the right item from cached.
For context, what I'm trying to accomplish is when a doc is soft deleted, ensure it is optimistically removed from the paginated result set(s) its present in.13 replies
CCConvex Community
•Created by allen on 4/17/2023 in #support-community
Field name $id starts with a '$', which is reserved.
I started getting this error this morning when invoking an action. Not much further information or stack trace and cant find anything code using
$id
in my app.5 replies
CCConvex Community
•Created by allen on 4/14/2023 in #support-community
Query optional field on schema
I am looking to query an optional field with
.eq('fieldName', undefined)
, however, I am getting the error: [Error: Uncaught Error: undefined is not a valid Convex value. To learn about Convex's supported types, see https://docs.convex.dev/using/types.
The provided docs say to use null
but that then breaks generated types from optional fields, as the available options are number | undefined
.
I could refactor this into a union of a number or a null value, but figured I'd ask first as it seems like it should be possible to query an optional field directly.6 replies
CCConvex Community
•Created by allen on 4/6/2023 in #support-community
Crypto dependency
It seems that the convex client has a dependency on the Crypto API (https://developer.mozilla.org/en-US/docs/Web/API/Crypto) which is not available in the React Native runtime.
I am encountering this when trying to optimistically insert a document into the local cache. Even if I don't lean on the
crypto
api directly like the documentation suggests (https://docs.convex.dev/client/react/optimistic-updates#complex-example) and provide a different random string, it still seems the convex client attempts to use this api.
Before I go hunting for a polyfill or shim, I was wondering if there is another approach I can take.20 replies
CCConvex Community
•Created by allen on 4/4/2023 in #support-community
Paginated query briefly returning empty array
I'm observing a defective behavior where a newly mounted paginated query briefly returns an empty array before returning a result set. The expected behavior is that it returns undefined until results are ready. This results in my app rendering an empty state view instead of a loading view while this query is in flight.
There is some async linked document population that occurs, but I'm unsure why that would impact the query resolution.
The basic design of my query is as follows:
12 replies
CCConvex Community
•Created by allen on 3/31/2023 in #support-community
Paginated Query Design
Lets say you have a table of messages, and you have two views in your app: Inbox and Archived.
What is the best way to design pagination queries for these two views that optimizes caching and is responsive to messages ingressing and egressing these states?
1) two separate query functions with fixed filters
2) one query with an arg to denote which messages we are currently interested in
3) doesnt matter
4) something else entirely
34 replies
CCConvex Community
•Created by allen on 3/30/2023 in #support-community
Auth not working for some users
I have the same codebase running from two devices for two users and seeing two different sets of behavior and unsure how to resolve.
My client does the following:
For one user, everything works as expected. For another, my
createUser
mutation throws because the request isnt authorized (auth.getUserIdentity()
returns null).
I have verified that a JWT is returned from getToken
.
I set a timeout prior to calling the mutation of 1000ms to see if there was a race condition, but that produced the same results.
I am unsure how to further debug this or inspect why setAuth
doesnt appear to be functioning in this case.17 replies
CCConvex Community
•Created by allen on 3/29/2023 in #support-community
Title of function with export name
12 replies