noob saibot
CCConvex Community
•Created by noob saibot on 12/13/2024 in #support-community
Help me better understand paginated queries
I'm having trouble running a paginated query in server using the
filter
from the convex-helpers
library when, in client, I give a small value to initialNumItems
.
I have 2 tables:
table campaigns
table members
Now I want to find all the campaigns where "user_id" is part of, using a paginated query. So I write this function:
The last query will return data only if I give a bigger value to initialNumItems
: with value 3
it returns 2 records, but with 10
then it find the 3 records I'm expecting.
It seems to me that the filtering I'm applying is messing up the cursor and perhaps the first record found by the pagination is beyond the initial cursor?8 replies
CCConvex Community
•Created by noob saibot on 12/6/2024 in #support-community
Help needed: Integrate Launchdarkly with Convex Dev
I am following the tutorial here https://www.convex.dev/components/launchdarkly to setup Launchdarkly with Convex Dev.
I am at the step of setting up integration on LaunchDarkly Dashboard. I have filled the fields "name, environment, webhook url, component API token". Then I save the configuration. When I click the configuration form again to validate the configuration, I am presented with an empty form.
So I decide to fill it again. When I attempt to generate a new token (I closed the terminal and lost the previous one), I'm getting the error message
"A token already exists. Delete the existing token from the tokens table to generate a new one"
16 replies
CCConvex Community
•Created by noob saibot on 11/30/2024 in #support-community
using push notifications component in monorepo with react native expo
7 replies
CCConvex Community
•Created by noob saibot on 11/26/2024 in #support-community
How to implement pagination with join and filtering
Given that I have these 2 tables that describes a 1-to-many relationship: "a user can be member of 1 or many groups"
What would be the convex way to implement the following
paginated
query: get groups of user A (each page has 10 items)
. This is (a naive) equivalent SQL
query:
4 replies
CCConvex Community
•Created by noob saibot on 11/14/2024 in #support-community
getUserIdentity returns null in Expo Clerk (Android)
I have a react native expo application and I use convex with clerk for authentication.
The
getUserIdentity
is returning null when called in a server function. This behaviour occurs only when the client is android. This behaviour does not occur with an IOS device (iphone).
This is how I make the call in a server function:
It is worth noting that this error started occuring when I upgraded Expo to the latest SDK 52 version. Before that, everything was working fine.4 replies
CCConvex Community
•Created by noob saibot on 10/13/2024 in #support-community
convex auth.getUserIdentity() is inconsistent
In my
nextjs
app, I have upgraded convex-dev/auth
to the latest version 0.0.71
. I went through the documentation and correctly setup authentication including properly setting up the middleware. (also I use email provider with resend
).
Now in my app, after login, I navigate to route /partners
. This route accesses the session user (in the backend) by calling contex.auth.getUserIdentity()
. This first call works fine as it returns the logged in user object.
But when I navigate to the subroute /partners/[id]
and makes the same call, this time it returns an empty. If I go back to the previous screen and refresh the page, I'm able to get the user object just fine.
Any idea what this behaviour?...3 replies
CCConvex Community
•Created by noob saibot on 10/6/2024 in #support-community
Convex Auth: react-native expo OTP throws Uncaught Error: Could not verify code
I'm using the new
convex auth
in my react-native expo. I'm trying to implement authentication with OTP.
After having followed the documentation here https://labs.convex.dev/auth/config/otps, I, then, follow the demo project here
https://github.com/get-convex/convex-auth-example/blob/main/src/auth/SignInFormPhoneCode.tsx
Now, because in my use case I'm not using twilio
to send OTP sms, I have to implement my custom solution, following above example.
First here, I have implemented my custom sms OTP provider:
This provider works fine. It correctly sends the sms otp.
Second, here I implement my custom "verify" function:
3 replies
CCConvex Community
•Created by noob saibot on 9/8/2024 in #support-community
Convex Auth getUserIdentity() returns object without email
I have 2 applications: a
nextjs
and a react native expo
app.
The nextjs app uses the new convex auth
lib for authentication while the expo
app uses clerk
.
I am observing that when auth.getUserIndentity()
is called from expo
(in other word called within a function called from expo), it returns a user object with all keys: user name, phoneNmber, emailVerified
...etc
But when I call it from nextjs
, it returns an object missing all above keys. Here is the returned object:
How can I use above object to identifier the user?1 replies
CCConvex Community
•Created by noob saibot on 8/10/2024 in #support-community
How to explicitly set the current page in a nextjs paginated query?
In my
nextjs
application, I have a use case where user can "jump" to a specific page and not only progress sequentially. For that user can indicate this url parameter ?page=n
. How can I apply this parameter in my paginated query? In other words, I have created my paginated query function:
The paginationOptsValidator
object defines a cursor
property. Is this the property I should use? If yes, how should I proceed?
Thanks2 replies
CCConvex Community
•Created by noob saibot on 8/7/2024 in #support-community
Convex auth: auth.getSessionId returns null
I have implemented the new
convex auth
lib in my nextjs
app. Now I'm attempting to retrieve the session id
or the logged in user
in my server function (query). Following the tutorial here https://labs.convex.dev/auth/authz#use-authentication-state-in-backend-functions, calling auth.getSessionId(ctx)
or auth.getUserId(ctx)
returns null.
The auth
object has been properly setup
39 replies
CCConvex Community
•Created by noob saibot on 8/5/2024 in #support-community
Unable to push deployment config to convex cloud
I am suddenly unable to automatically push my changes to convex cloud. Every time convex attempts to push changes, it throws below error
✖ Error: Unable to push deployment config to https://joyous-xxxxxxxxxx.convex.cloud
Error fetching POST https://joyous-xxxxxxxxxx.convex.cloud/api/push_config 500 Internal Server Error: InternalServerError: Your request couldn't be completed. Try again later.
Failed due to network error, retrying in 18.88s...
Does this error indicate that there is an error in the code I'm trying to push or there is perhaps something else going on remote?
Everything was working fine 5 minutes ago.
5 replies
CCConvex Community
•Created by noob saibot on 8/4/2024 in #support-community
Error: Unexpected type of undefined
5 replies
CCConvex Community
•Created by noob saibot on 7/27/2024 in #support-community
Convex + Clerk crashing in react-native after using the new Convex Auth
Hi Convex team,
I have 2 applications:
1 react-native-expo app using
convex.dev (+ clerk for authentication)
. This app has been happily working fine for the past 4 months.
1 nextjs
app (app router). For the nextjs
app, I have decided to use the new Convex Auth
library. So I followed the official documentation here https://labs.convex.dev/auth. I have successfully setup the new convex auth
in dev and in production. And everything works fine in the web.
Here is now my auth config with the 2 entries: the first entry is used with clerk (this is how I started my application). The second entry is the new convex auth
:
This morning, I decided to spin up my react native expo (using same convex backend). I'm observing that clerk
is crashing at start.
I'm not saying whether the crash is caused by this new setup (I have already filed an issue in the clerk
forum). But I'm just investigating whether the crash could be related to the my new setup.
Also I am hesitating to rollback my changes given that new tables related to authentication have already been created (in dev and in prod).
Can I safely rollback my changes (and see if it fixed my issues?)
Thank you for your support.7 replies
CCConvex Community
•Created by noob saibot on 7/24/2024 in #support-community
Convex Auth Magic Link with Resend: Uncaught Error: Uncaught Error: Index users.email not found.
I'm trying to setup the new Convex Auth in with Magic Link my Nextjs app. I'm following the official tutorial and the demo app. When I call
signIn("resend", formData)
, I'm getting the error:
I must have done some error somewhere but since this is very new, I can't figure out where to look at. I'm running this on localhost.
Here is my auth.config setup:
6 replies
CCConvex Community
•Created by noob saibot on 6/28/2024 in #support-community
Deploy Convex with Github Actions: Error: Please set CONVEX_DEPLOY_KEY to a new key
I would like to deploy convex to production via a Github Action. Here is a snippet of the action:
I have defined the variables
CONVEX_DEPLOY_KEY
and CONVEX_URL
in Github secrets for the production environment. But when I run the action, it constantly fails with error:
Please set CONVEX_DEPLOY_KEY to a new key which you can find on your Convex dashboard.
But I have successfully generated a deployment key in my project dashboard. Not sure how I can fix this error6 replies
CCConvex Community
•Created by noob saibot on 4/20/2024 in #support-community
Uncaught Error: `new Date()` with non-number arguments is not supported
I'm saving date as
iso string (with timezone info)
in my table. Then in a function, I would like to use this date in my business logic code. When I try to create a new date from the saved value with new Date(table.some_date)
, I'm getting above error. Does that mean that in convex
, dates should alway be saved in db as number
? This is not what I seemed to understand from the docs3 replies
CCConvex Community
•Created by noob saibot on 4/7/2024 in #support-community
Turborepo cache issue: Convex not deploying into production
I'm hosting my app on vercel. I'm observing that when I merge a feature branch into main and trigger a production build on vercel, convex deploys the changes into the dev environment and not in production (though I've set a
CONVEX_DEPLOY_KEY
for production). Here is the log of the automatically triggered production build:
But if I redeploy manually (from the vercel dashboard), then my changes are properly deployed into production. Here is the log of the manual redeployment:
Is this the way it should work? Should I always manually deploy my changes in production or shouldn't it occur automatically every time when vercel builds for production?4 replies
CCConvex Community
•Created by noob saibot on 3/14/2024 in #support-community
Unable to use a node package
I am creating an
http action
which imports the node package twilio
. I'm getting a series of errors for different packages used by twilio
, (e.g crypto, stream,) not found on the file system but built into node
:
Even when I add use node
on top of the action file. I'm still getting this error.3 replies
CCConvex Community
•Created by noob saibot on 3/10/2024 in #support-community
Vercel build environment detected but CONVEX_DEPLOY_KEY is not set
I have followed the official tutorial to deploy my convex app with
vercel
. In my Convex dashboard
, I have generated a production deploy key
and I have assigned it to the CONVEX_DEPLOY_KEY
environment variable on Vercel
. Then I have checked only the Production
environment. But the build fails with the error:
Vercel build environment detected but CONVEX_DEPLOY_KEY is not set. Set this environment variable to deploy from this environment. See https://docs.convex.dev/production/hosting
4 replies