adam
adam
CCConvex Community
Created by mikeysee on 9/29/2023 in #support-community
Convex and State Machines
I would also be interested in knowing when I should reach for using XState? From what I understand, it's useful for restricting state transitions so that states can only be transitioned in a certain order. I see some overlap with multi step workflows, and I'm curious how XState would be related to multi-step workflows such as Temporal, n8n/Zapier?
15 replies
CCConvex Community
Created by Adam Harris on 6/28/2024 in #support-community
Can't import snapshot to dev
Upon double checking I found an empty table that was included, so I don't think this is the bug actually. There was a table missing in the export though (named "docMigrations"), that was the cause of the "..has IDs that conflict with existing table..." error it seems (it was an empty table).
9 replies
CCConvex Community
Created by Adam Harris on 6/28/2024 in #support-community
Can't import snapshot to dev
I think the issue is that empty tables are not included in the export data. If I unpack the .zip, and look at ./_tables/documents.jsonl I can see that the first table listed here is the one shown in the error message. I notice my empty table is not listed in this file, which is the one that it is conflicting with. Would including empty tables in the export avoid this issue @lee?
9 replies
CCConvex Community
Created by erquhart on 12/1/2023 in #support-community
Uncaught Error: `new Date()` with non-number arguments is not supported.
That’s a good idea @Clever Tagline I’ll give it a go, thanks
66 replies
CCConvex Community
Created by erquhart on 12/1/2023 in #support-community
Uncaught Error: `new Date()` with non-number arguments is not supported.
Thanks. I can work around the lack of TZDate support in mutations, but using Convex actions. However, for Convex queries I have no suitable workaround because they can't be switched out with actions as easily - live subscriptions would be broken. I could setup a HTTP endpoint (using an action) but is starts to be loose a lot of the Convex benefits quickly. Essentially, I want to fetch all orders for the current day only (dependent on my merchant.timeZone setting). Order date is store as a timestamp. Any suggestions how I do this using a Convex query?
66 replies
CCConvex Community
Created by erquhart on 12/1/2023 in #support-community
Uncaught Error: `new Date()` with non-number arguments is not supported.
I don't think the system time matters when using TZDate?. Yep, it works fine within a Convex action with "use node".
66 replies
CCConvex Community
Created by sshader on 10/3/2024 in #support-community
Auth token is not a valid JWT, cannot refetch the token on upgrade from Convex 1.15 -> 1.16.3
Great, thank you @sshader. I'll try with an updated version of React Native in the coming weeks.
14 replies
CCConvex Community
Created by erquhart on 12/1/2023 in #support-community
Uncaught Error: `new Date()` with non-number arguments is not supported.
It works as expected if code is placed within a Convex action, just not within a query/mutation.
66 replies
CCConvex Community
Created by Riki on 9/11/2024 in #support-community
[React-Native] Custom Auth - JWT refresh issue
Could you please add a link to the new thread?
16 replies
CCConvex Community
Created by erquhart on 12/1/2023 in #support-community
Uncaught Error: `new Date()` with non-number arguments is not supported.
Should date-fns v4 be supported with this change? In particular @date-fns/tz ? I didn't receive any Convex runtime error when trying to import from @date-fns/tz so I assumed it should work, but it doesn't seem to be working correctly.
import { TZDate, tz } from '@date-fns/tz';
const melbourneTime = new TZDate(1728222554737, 'Australia/Melbourne');

console.log(melbourneTime.toString());
// Convex runtime: 'Sun Oct 06 2024 13:49:14 GMT+0000 (Coordinated Universal Time)'
// locally using vitest: 'Mon Oct 07 2024 00:49:14 GMT+1100 (Australian Eastern Daylight Time)'
import { TZDate, tz } from '@date-fns/tz';
const melbourneTime = new TZDate(1728222554737, 'Australia/Melbourne');

console.log(melbourneTime.toString());
// Convex runtime: 'Sun Oct 06 2024 13:49:14 GMT+0000 (Coordinated Universal Time)'
// locally using vitest: 'Mon Oct 07 2024 00:49:14 GMT+1100 (Australian Eastern Daylight Time)'
66 replies
CCConvex Community
Created by Riki on 9/11/2024 in #support-community
[React-Native] Custom Auth - JWT refresh issue
After updating convex from 1.15.0 to 1.16.3 I have started to get console error of "Auth token is not a valid JWT, cannot refetch the token" raised on app startup. The issue doesn't happen on 1.15.0, so I've rolled back to this version for now. I'm using "expo": "49.0.20" convex-js code that is being triggered is in src/browser/sync/authentication_manager.ts - scheduleTokenRefetch(token: string) function.
16 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
import { Amplify, Auth, Hub } from 'aws-amplify';
59 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
For reference here is my fetchAccessToken function:
/**
* Convex calls this function automatically with `forceRefreshToken` set to `true`.
* https://docs.convex.dev/auth/advanced/custom-auth
*/
const fetchAccessToken = useCallback(
async ({ forceRefreshToken }: { forceRefreshToken: boolean }) => {
try {
if (forceRefreshToken) {
const user: CognitoUser = await Auth.currentAuthenticatedUser({ bypassCache: true });
}
const session = await Auth.currentSession();
setIsAuthenticated(true);
return session.getIdToken().getJwtToken();
} catch (error) {
setIsAuthenticated(false);
return null;
}
},
[]
);
/**
* Convex calls this function automatically with `forceRefreshToken` set to `true`.
* https://docs.convex.dev/auth/advanced/custom-auth
*/
const fetchAccessToken = useCallback(
async ({ forceRefreshToken }: { forceRefreshToken: boolean }) => {
try {
if (forceRefreshToken) {
const user: CognitoUser = await Auth.currentAuthenticatedUser({ bypassCache: true });
}
const session = await Auth.currentSession();
setIsAuthenticated(true);
return session.getIdToken().getJwtToken();
} catch (error) {
setIsAuthenticated(false);
return null;
}
},
[]
);
59 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
@sshader I've confirmed the issue I'm experiencing is related to the refresh token flow. Here are the details to reproduce: 1) Use Convex custom auth with AWS Cognito and Expo 2) Create a production build of the app 3) Set Cognito refresh token to min (60min) 4) Open the app and then send it to the background 5) Bring the app back to the foreground after 60min to observe the issue const userIdentity: UserIdentity | null = await ctx.auth.getUserIdentity(); I assume it's incorrectly being set to null here. I'm working around this issue for now by extending my refresh token expiry period.
59 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
It could be a seperate issue, I guess
59 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
I’m using custom auth though, not Convex Auth.
59 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
Thanks sshader. Could it be related to web socket’s connection expiring? Is there an idle timeout or anything like this when using web sockets? I’ll try observing how long the app needs to be in the background for before it triggers this issue.
59 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
I suspect it is related to userIdentity being set to null under some conditions, when it should not be.
const userIdentity: UserIdentity | null = await ctx.auth.getUserIdentity();
const userIdentity: UserIdentity | null = await ctx.auth.getUserIdentity();
59 replies
CCConvex Community
Created by erquhart on 8/13/2024 in #support-community
Convex Auth signaling unauthenticated in RN after inactive
@sshader could you please look into this? I'm also experiencing this issue with my React Native app, and it's very frustrating for users to be unexpectedly logged out. I'm using custom auth, connected to AWS Cognito. The setup follows the approach described here: https://docs.convex.dev/auth/advanced/custom-auth
59 replies
CCConvex Community
Created by adam on 8/24/2024 in #support-community
Convex dashboard suggestion (DX)
I can now see this new UI in my account @ari - its working better than I was expecting it would. I'll collect my feedback over the coming days.
12 replies