oscklm
oscklm
CCConvex Community
Created by oscklm on 11/22/2024 in #support-community
Issue with convex being picked up by `npx tsc` in expo project
Okay, just got something to change the outcome a bit. Which seems to no longer result in tsc errors coming from the convex/ directory: I went and imported the tsconfig settings from the expo base tsconfig into my own and commented out this specific setting esModuleInterop:
{
// "extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"allowJs": true,
// "esModuleInterop": true,
"jsx": "react-native",
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ESNext",
"paths": {
"@/*": ["./*"]
},
"moduleSuffixes": [".ios", ".android", ".native", ""]
},
"exclude": ["convex"],
"include": ["**/*.tsx", "**/*.ts", ".expo/types/**/*.ts", "expo-env.d.ts", "vitest.config.mts"]
}
{
// "extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"allowJs": true,
// "esModuleInterop": true,
"jsx": "react-native",
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ESNext",
"paths": {
"@/*": ["./*"]
},
"moduleSuffixes": [".ios", ".android", ".native", ""]
},
"exclude": ["convex"],
"include": ["**/*.tsx", "**/*.ts", ".expo/types/**/*.ts", "expo-env.d.ts", "vitest.config.mts"]
}
Now my npx tsc doesnt error or pick up anything from the /convex directories, yet it now errors about 232 other issues with my project now 🫠 so sadly wont do as a fix leavin this info here in case that gives food for though for anything more experienced with tsconfigs
21 replies
CCConvex Community
Created by oscklm on 11/22/2024 in #support-community
Issue with convex being picked up by `npx tsc` in expo project
Yeah the main thing im also wondering. But could be any of the tsconfig settings from either expo's tsconfig base file, i've tried for many hours fiddiling with removing certain settings 1 by 1, but without any luck of getting closer to figuring out whats happening: Deleting the tsconfig in the convex folder doesn't change the result of running the npx tsc -p . or any other variant of the npx tsc cmd
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Expo",

"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"jsx": "react-native",
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ESNext"
},

"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
}
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Expo",

"compilerOptions": {
"allowJs": true,
"esModuleInterop": true,
"jsx": "react-native",
"lib": ["DOM", "ESNext"],
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ESNext"
},

"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
}
Or from my root:
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"skipLibCheck": true,
"paths": {
"@/*": ["./*"]
},
"moduleSuffixes": [".ios", ".android", ".native", ""]
},
"exclude": ["convex"],
"include": ["**/*.tsx", "**/*.ts", ".expo/types/**/*.ts", "expo-env.d.ts", "vitest.config.mts"]
}
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"skipLibCheck": true,
"paths": {
"@/*": ["./*"]
},
"moduleSuffixes": [".ios", ".android", ".native", ""]
},
"exclude": ["convex"],
"include": ["**/*.tsx", "**/*.ts", ".expo/types/**/*.ts", "expo-env.d.ts", "vitest.config.mts"]
}
21 replies
CCConvex Community
Created by oscklm on 11/22/2024 in #support-community
Issue with convex being picked up by `npx tsc` in expo project
ty though
21 replies
CCConvex Community
Created by oscklm on 11/22/2024 in #support-community
Issue with convex being picked up by `npx tsc` in expo project
not a mono repo, and not using turborepo either
21 replies
CCConvex Community
Created by oscklm on 11/22/2024 in #support-community
Issue with convex being picked up by `npx tsc` in expo project
No luck with -p either, problem still persists.
21 replies
CCConvex Community
Created by oscklm on 11/22/2024 in #support-community
Issue with convex being picked up by `npx tsc` in expo project
unfortunately I've already tried all possible glob patterns there is, this doesn't affect anything in my case.
21 replies
CCConvex Community
Created by TwendyKirn on 9/22/2024 in #support-community
Quering random row
Big yes! We are looking at using quite a lot of randomization in our app, anything helping us in this area would be suuper helpfull!
20 replies
CCConvex Community
Created by oscklm on 9/22/2024 in #support-community
Designing a friend system with Convex
Thanks! that helps in making a decision. Will go with duplicate entries
4 replies
CCConvex Community
Created by oscklm on 9/17/2024 in #support-community
using _storageId vs storing storage urls directly
Awesome! Wow im very excited to check out this approach. Thanks for the quick reply 🙏
24 replies
CCConvex Community
Created by oscklm on 9/17/2024 in #support-community
using _storageId vs storing storage urls directly
Ohh that's very interesting, never thought about that. So am i understanding correctly, that essentially we should make our own url endpoint, that resolves in some file ?? so we would expose our own convex httpAction endpoint like domain.com/image/[_storageId].webp But i actually have no clue how to implement something like that, like make a http endpoint that resolves a image.
24 replies
CCConvex Community
Created by oscklm on 9/13/2024 in #support-community
Require cycle issues, can't seem to troubleshoot to where its coming from
That explains it. I had some similiar require cycle warnings in some of my own code, not so long ago. So actually thought for a second it was something i had caused. But i can tell, since it is in fact coming from the node_modules/ that indicates its inside the library. Thanks for clearing that up! I will just ignore this until that!
3 replies
CCConvex Community
Created by oscklm on 9/10/2024 in #support-community
[ConvexAuth] stuck on auth loading & websocket reconnect
Thanks. That sounds great, im sure it would help out some people ending up in the same situation.
9 replies
CCConvex Community
Created by oscklm on 9/10/2024 in #support-community
[ConvexAuth] stuck on auth loading & websocket reconnect
The issue is resolved! This issue was caused by the http.ts missing in our convex folder... Stupid mistake. Very much a big learning lesson for us. But we recently migrated away from a monorepo setup, and to a more simple repo and moved to using expo web etc. In hinsight, we should've been more causious when moving over everything... We tried everything, but looking at if we were missing any config files for the auth implementation. We are still not able to demystify one of the dev deployments still working, even being deployed with the exact same convex backend code, schema and everything. But that i guess we wont find out why anytime soon.
9 replies
CCConvex Community
Created by oscklm on 9/10/2024 in #support-community
[ConvexAuth] stuck on auth loading & websocket reconnect
The repro is available here btw. In case you or someone from the team have the chance to take a look. It's possible to just run the expo web app after running yarn dev and hitting w and the there is a super minimal example of the issue happening, the websocket errors we experience above can be seen in the browser console. https://github.com/oscklm/flimmer-auth-issue
9 replies
CCConvex Community
Created by oscklm on 9/10/2024 in #support-community
[ConvexAuth] stuck on auth loading & websocket reconnect
The verbose: true seems to not log out anything different In regards to the whole import from dist vs not from dist. I did already try making sure nothing was imported from dist, and had no effect on the issue for me.
9 replies
CCConvex Community
Created by oscklm on 9/5/2024 in #support-community
Verifying JWS Signed Payload in Convex httpAction
I've fixed the above issues, simply by sending the signedPayload directly to be processed by an action:
export default httpAction(async (ctx, req) => {
const { signedPayload } = await req.json();

if (signedPayload) {
await ctx.runAction(api.apple.appleNotificationProcessor.default, { signedPayload });
return new Response('Success', { status: 200 });
}
return new Response('Invalid notification format', { status: 400 });
});
export default httpAction(async (ctx, req) => {
const { signedPayload } = await req.json();

if (signedPayload) {
await ctx.runAction(api.apple.appleNotificationProcessor.default, { signedPayload });
return new Response('Success', { status: 200 });
}
return new Response('Invalid notification format', { status: 400 });
});
2 replies
CCConvex Community
Created by oscklm on 8/26/2024 in #support-community
[ConvexAuth]: Handling errors that happen from the useAuthActions methods
Seems like this is already mentioned as an issue by ian here: https://github.com/get-convex/convex-auth/issues/54 I'd love to know if there is any suggested work around for now?
2 replies
CCConvex Community
Created by oscklm on 8/8/2024 in #support-community
[ConvexAuth] Convex 1.14 seems to break ConvexAuthProvider token storage
I failed to add to my original message that this is in react native, with expo secure store. I have tried the following Switching back and forth again between convex 1.13.2 and 1.14.0, with @convex-dev/auth 0.0.47 and the same issues between the those persists, with the token storage not getting correctly, thus never authenticating the user even though the token is actually there in expo secure store But now, even after switching back to what worked with convex 1.13.2 a new issue has returned, which i have had previously seemed this ERROR Auth token is not a valid JWT, cannot refetch the token and i have tried most of the most common things (wiping node_modules & yarn lock) no logic thouching JWT's etc. has been touched, at least to my understanding. I'm gonna leave this here, and revisit this with a fresh set of eyes tomorrow. It's not a blocking issue, with the error saying the jwt auth token isnt valid luckily
9 replies
CCConvex Community
Created by oscklm on 8/8/2024 in #support-community
[ConvexAuth] Convex 1.14 seems to break ConvexAuthProvider token storage
I've tried removing / disabling the logging behaviour i have wrapped the secureStorage functionality in. But had no effect on the issue
9 replies
CCConvex Community
Created by oscklm on 8/8/2024 in #support-community
[ConvexAuth] Convex 1.14 seems to break ConvexAuthProvider token storage
Im unsure why switching back to 1.13.2 fixes the issue. But this is the client provider for reference:
import { ConvexAuthProvider } from '@convex-dev/auth/react';
import { ConvexReactClient } from 'convex/react';
import * as SecureStore from 'expo-secure-store';
const convex = new ConvexReactClient(process.env.EXPO_PUBLIC_CONVEX_URL);

const enableLogging = __DEV__;

const secureStorage = {
getItem: async (key: string) => {
try {
const value = await SecureStore.getItemAsync(key);
if (enableLogging) {
console.log(`SecureStore.getItemAsync - Key: ${key}, Value: ${value}`);
}
return value;
} catch (error) {
if (enableLogging) {
console.error(`Error getting item with key ${key}`, error);
}
throw error;
}
},
setItem: async (key: string, value: string) => {
try {
await SecureStore.setItemAsync(key, value);
if (enableLogging) {
console.log(`SecureStore.setItemAsync - Key: ${key}, Value: ${value}`);
}
} catch (error) {
if (enableLogging) {
console.error(`Error setting item with key ${key}`, error);
}
throw error;
}
},
removeItem: async (key: string) => {
try {
await SecureStore.deleteItemAsync(key);
if (enableLogging) {
console.log(`SecureStore.deleteItemAsync - Key: ${key}`);
}
} catch (error) {
if (enableLogging) {
console.error(`Error removing item with key ${key}`, error);
}
throw error;
}
},
};

export default function ConvexClientProvider({ children }: { children: React.ReactNode }) {
return (
<ConvexAuthProvider storage={secureStorage} client={convex}>
{children}
</ConvexAuthProvider>
);
}
import { ConvexAuthProvider } from '@convex-dev/auth/react';
import { ConvexReactClient } from 'convex/react';
import * as SecureStore from 'expo-secure-store';
const convex = new ConvexReactClient(process.env.EXPO_PUBLIC_CONVEX_URL);

const enableLogging = __DEV__;

const secureStorage = {
getItem: async (key: string) => {
try {
const value = await SecureStore.getItemAsync(key);
if (enableLogging) {
console.log(`SecureStore.getItemAsync - Key: ${key}, Value: ${value}`);
}
return value;
} catch (error) {
if (enableLogging) {
console.error(`Error getting item with key ${key}`, error);
}
throw error;
}
},
setItem: async (key: string, value: string) => {
try {
await SecureStore.setItemAsync(key, value);
if (enableLogging) {
console.log(`SecureStore.setItemAsync - Key: ${key}, Value: ${value}`);
}
} catch (error) {
if (enableLogging) {
console.error(`Error setting item with key ${key}`, error);
}
throw error;
}
},
removeItem: async (key: string) => {
try {
await SecureStore.deleteItemAsync(key);
if (enableLogging) {
console.log(`SecureStore.deleteItemAsync - Key: ${key}`);
}
} catch (error) {
if (enableLogging) {
console.error(`Error removing item with key ${key}`, error);
}
throw error;
}
},
};

export default function ConvexClientProvider({ children }: { children: React.ReactNode }) {
return (
<ConvexAuthProvider storage={secureStorage} client={convex}>
{children}
</ConvexAuthProvider>
);
}
9 replies