Jonathan
Jonathan
Explore posts from servers
CCConvex Community
Created by Jonathan on 4/25/2025 in #support-community
ESLint Errors in Vite Template
Does anyone else get this type of eslint issue when using the default Vite template?
Parsing error: ESLint was configured to run on `<tsconfigRootDir>/convex/backfill.ts` using `parserOptions.project`:
- <tsconfigRootDir>/tsconfig.node.json
- <tsconfigRootDir>/tsconfig.app.json
However, none of those TSConfigs include this file. Either:
- Change ESLint's list of included files to not include this file
- Change one of those TSConfigs to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-fileeslint
Parsing error: ESLint was configured to run on `<tsconfigRootDir>/convex/backfill.ts` using `parserOptions.project`:
- <tsconfigRootDir>/tsconfig.node.json
- <tsconfigRootDir>/tsconfig.app.json
However, none of those TSConfigs include this file. Either:
- Change ESLint's list of included files to not include this file
- Change one of those TSConfigs to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-fileeslint
2 replies
CCConvex Community
Created by Jonathan on 4/25/2025 in #support-community
Quick Reset for Dev DB
Is there a quick reset for dev data? Or is it better to just do a local dev when needing to do that. Essentially I am making changes fast, creating a function create initial set of data and would like to just reset it sometimes easily.
2 replies
CCConvex Community
Created by Jonathan on 4/25/2025 in #support-community
Normilization Best Practices
Does anyone have a guide to best practices for normilization of the tables in Convex, maybe assumptions you would do in RDMS/SQL but wouldn't do in Convex.
6 replies
CCConvex Community
Created by Jonathan on 4/25/2025 in #support-community
Multiple Clerk Apps with 1 Convex
Is it possible to use 1 Convex DB with multiple Clerk applications? My use case is this: - Backend Clerk App - This is used by our customers to maintain their data - Customer's Portals - This is used for their customers to submit data. Is this possible?
2 replies
CCConvex Community
Created by Jonathan on 4/25/2025 in #support-community
Handling Updating Large amounts of Rows
If I need to update thousands of rows, what is the best approach for this to not get hit with mutation limits?
11 replies
CCConvex Community
Created by Jonathan on 4/25/2025 in #support-community
AG-Grid Datasource
Has anyone built an AG-Grid Data Source for Convex? I use ag-grid and it might be worth building an opensource library for it to handle paging and such easily with convex.
3 replies
CCConvex Community
Created by Jonathan on 4/21/2025 in #support-community
Transaction Log/Audit Log in Convex
Is there a good way to build an audit log in convex? Just thinking through how some of the foundational pieces of convex actually works with its transaction log, is there any way to access this log through the sdk? I would like to be able to track what users change which data and would love to have that information if it is available already.
2 replies
CCConvex Community
Created by Jonathan on 4/17/2025 in #support-community
Custom Metadata/Extending Schema
Is it possible to extend or add additional metadata/properties on the schema? We keep a few extra properties on a "schema" like object in our app now, would be nice to just merge the concept. For example it can be something as simple as label for the label that is on the field. Or other things like input_type which may be the type of input control to use. Is it possible to do this and also read the schema in our application?
3 replies
CCConvex Community
Created by Jonathan on 4/14/2025 in #support-community
Migrating to Convex from RDMS/SQL
I would love to hear about someone's approach moving from a traditional SQL platform to Convex and any patterns or practices they took. For me we run a very large CRM application and would love to move to something like Convex even if it was some type of lift and shift approach. But I would love to hear opinions or approaches anyone has taken. I feel like we could start finding a way to use Convex just for reading data on a small scale but it is when we want to shift to writing is the big question.
51 replies
CCConvex Community
Created by Jonathan on 4/14/2025 in #support-community
Pub/Sub Topic Structure
Does Convex offer any type of pub/sub topic based solution? I have looked at the workflow features and they are close but I do have cases wher eI want to fan out events to additional subscribers. I have used Reddis and Inngest in the past.
5 replies
CCConvex Community
Created by Jonathan on 4/12/2025 in #support-community
Getting started with Convex and MonoRepo
I am looking at building a project that has the following: - Mobile Expo App - Multiple Next JS applications In the past I always do this in a monorepo, is there anything special I have to do to make the apps use the same generated code? Is there any best practices?
10 replies
TtRPC
Created by Jonathan on 2/21/2025 in #❓-help
Where did useUtils go?
I am working through upgrading my project and I use useUtils here and there to do fetches from components like ag-grid which requires a data source It looks something like this
const utils = useUtils();
const dataSource = useMemo(() => {
return {
getRows: async (params: any) => {

utils.contacts.grid.fetch().then((response) => {
params.success({
rowData: response.rows,
rowCount: response.totalCount,
});
});

}
}
}, []);
const utils = useUtils();
const dataSource = useMemo(() => {
return {
getRows: async (params: any) => {

utils.contacts.grid.fetch().then((response) => {
params.success({
rowData: response.rows,
rowCount: response.totalCount,
});
});

}
}
}, []);
I thought it had moved to something under getting the trpc using the useTRPC but it doesn't seem to be there, how should I get this to work?
8 replies
TtRPC
Created by Jonathan on 2/18/2025 in #❓-help
Missing Module in TRPC Migrate
I know you just released the migration for the TRPC upgrade but I thought I would share that I got this error
❯ npx @trpc/[email protected]
node:internal/modules/cjs/loader:1408
throw err;
^

Error: Cannot find module '@effect/printer-ansi/Ansi'
❯ npx @trpc/[email protected]
node:internal/modules/cjs/loader:1408
throw err;
^

Error: Cannot find module '@effect/printer-ansi/Ansi'
3 replies
TtRPC
Created by Jonathan on 1/24/2025 in #❓-help
How to Test TRPC
I am trying to setup testing TRPC My Init looks like this:
import { initTRPC, TRPCError } from "@trpc/server";
import superjson from "superjson";
import { ZodError } from "zod";

import { auth, clerkClient } from "@clerk/nextjs/server";

// export const createTRPCContext = async (opts: { headers: Headers }) => {
export const createTRPCContext = async () => {
// This is where you would do things like verify the user's session, etc.
const authResult = await auth();

return {
clerk: authResult,
};
};

const t = initTRPC.context<typeof createTRPCContext>().create({
transformer: superjson,
errorFormatter({ shape, error }) {
return {
...shape,
data: {
...shape.data,
zodError:
error.cause instanceof ZodError ? error.cause.flatten() : null,
},
};
},
});

export const createCallerFactory = t.createCallerFactory;

export const createTRPCRouter = t.router;

export const publicProcedure = t.procedure;

const isAuthed = t.middleware(async ({ next, ctx }) => {
if (!ctx.clerk.userId) {
throw new TRPCError({ code: "UNAUTHORIZED", message: "Not logged in" });
}

const client = await clerkClient();

const memberships = await client.users.getOrganizationMembershipList({
userId: ctx.clerk.userId,
});

const activeMembership = memberships.data.find(
(mem) => mem.organization.id === ctx.clerk.orgId,
);

return next({
ctx: {
user: ctx.clerk.userId,
CustomerId: activeMembership?.organization.publicMetadata?.customerId as string,
UserId: activeMembership?.publicMetadata?.userId as string,
},
});
});

/** Reusable middleware that enforces users are logged in before running the procedure. */
export const protectedProcedure = t.procedure.use(isAuthed);
import { initTRPC, TRPCError } from "@trpc/server";
import superjson from "superjson";
import { ZodError } from "zod";

import { auth, clerkClient } from "@clerk/nextjs/server";

// export const createTRPCContext = async (opts: { headers: Headers }) => {
export const createTRPCContext = async () => {
// This is where you would do things like verify the user's session, etc.
const authResult = await auth();

return {
clerk: authResult,
};
};

const t = initTRPC.context<typeof createTRPCContext>().create({
transformer: superjson,
errorFormatter({ shape, error }) {
return {
...shape,
data: {
...shape.data,
zodError:
error.cause instanceof ZodError ? error.cause.flatten() : null,
},
};
},
});

export const createCallerFactory = t.createCallerFactory;

export const createTRPCRouter = t.router;

export const publicProcedure = t.procedure;

const isAuthed = t.middleware(async ({ next, ctx }) => {
if (!ctx.clerk.userId) {
throw new TRPCError({ code: "UNAUTHORIZED", message: "Not logged in" });
}

const client = await clerkClient();

const memberships = await client.users.getOrganizationMembershipList({
userId: ctx.clerk.userId,
});

const activeMembership = memberships.data.find(
(mem) => mem.organization.id === ctx.clerk.orgId,
);

return next({
ctx: {
user: ctx.clerk.userId,
CustomerId: activeMembership?.organization.publicMetadata?.customerId as string,
UserId: activeMembership?.publicMetadata?.userId as string,
},
});
});

/** Reusable middleware that enforces users are logged in before running the procedure. */
export const protectedProcedure = t.procedure.use(isAuthed);
My test looks like this
import { type inferProcedureInput } from "@trpc/server";
import { expect, test } from "vitest";

import { appRouter, type AppRouter } from "@/server/routers/_app";
import { createTRPCContext } from "@/server/init";


test("example router", async () => {
const ctx = await createTRPCContext();
const caller = appRouter.createCaller(ctx);

type Input = inferProcedureInput<AppRouter["entities"]["get"]>;
const input: Input = {
entityType: "test",
Id: "test",
};

const example = await caller.entities.get(input);

expect(example).toMatchObject({ greeting: "Hello test" });
});
import { type inferProcedureInput } from "@trpc/server";
import { expect, test } from "vitest";

import { appRouter, type AppRouter } from "@/server/routers/_app";
import { createTRPCContext } from "@/server/init";


test("example router", async () => {
const ctx = await createTRPCContext();
const caller = appRouter.createCaller(ctx);

type Input = inferProcedureInput<AppRouter["entities"]["get"]>;
const input: Input = {
entityType: "test",
Id: "test",
};

const example = await caller.entities.get(input);

expect(example).toMatchObject({ greeting: "Hello test" });
});
All I really need in the context to test with is CustomerId and UserId but how do I build a test context that has this information?
4 replies
PPrisma
Created by Jonathan on 1/23/2025 in #help-and-questions
Using Prisma with Azure SQL Hyperscale
Is anyone using Prisma with Azure SQL Hyperscale? I am running into an issue that when the sql azure scales up or down there is a massive slow down in the application and errors from disconnections of the connection pooling. I am curious how others may have solved this. In .NET's EF they had automatic retry logic but is there an equavaliant in Prisma?
6 replies
PPrisma
Created by Jonathan on 12/14/2024 in #help-and-questions
db Pull not pulling schemas
When I am doing a prisma db pull in a file that I have about 10 schemas defined in the schema file
datasource db {
provider = "sqlserver"
url = env("DATABASE_URL")
schemas = [... 10 schemas here]
}
datasource db {
provider = "sqlserver"
url = env("DATABASE_URL")
schemas = [... 10 schemas here]
}
It seems that it just skips several of the schemas after the first about few, is there a limit of the number of schemas that can be pulled?
5 replies
DDeno
Created by Jonathan on 10/16/2024 in #help
Setting up Deno 2.0 with Fresh and TypeORM
I am trying to setup my first deno project ever using Fresh and TypeORM. I have setup 2 files A data.ts
import { DataSource } from "npm:typeorm";
import { User } from "../modules/auth/user.model.ts";

const dataSource = new DataSource({
type: "mssql",
url: Deno.env.get("DATABASE_URL"),
entities: [User],
});

export default dataSource;
import { DataSource } from "npm:typeorm";
import { User } from "../modules/auth/user.model.ts";

const dataSource = new DataSource({
type: "mssql",
url: Deno.env.get("DATABASE_URL"),
entities: [User],
});

export default dataSource;
And a user.model.ts
import { Column, Entity, PrimaryColumn } from "npm:typeorm";

@Entity({ name: "User" })
export class User {
@PrimaryColumn()
id: string;

@Column()
email: string;

}
import { Column, Entity, PrimaryColumn } from "npm:typeorm";

@Entity({ name: "User" })
export class User {
@PrimaryColumn()
id: string;

@Column()
email: string;

}
I am getting a few errors in the user.model.ts , I am not sure if I am importing type orm correctly.
Unable to resolve signature of property decorator when called as an expression.
Unable to resolve signature of property decorator when called as an expression.
I am also not sure how to properly install the mssql properly for deno, do I do that in the deno.json? If so how? And last, I am getting an error of an uncaught promise in Reflect.getMetadata. How do I get around this?
4 replies
RRefine
Created by sensitive-blue on 9/4/2024 in #ask-any-question
Closing modal after save, gives warning that you are leaving the page.
I have a modal like this:
import { Form, Input, Modal } from "antd";
import { useModalForm } from "@refinedev/antd";
import { useGetToPath, useGo } from "@refinedev/core";
import { useSearchParams } from "react-router-dom";

export const SourceCreate = () => {

const getToPath = useGetToPath();
const [searchParams] = useSearchParams();
const go = useGo();

const { modalProps, formProps, onFinish, close, form } = useModalForm<any>({
action: "create",
resource: "sources",
defaultVisible: true,
redirect: false,
mutationMode: "pessimistic",

});

const handleFinish = async (values: any) => {
try {
await onFinish(values);

close();
navigateToList();
} catch (error) {
console.error(error);
}
};

const navigateToList = () => {
go({
to: searchParams.get("to") ?? getToPath({ action: "list" }) ?? "",
query: { to: undefined },
options: { keepQuery: true },
type: "replace",
});
};

return (
<Modal
{...modalProps}
title="Create Source"
onCancel={() => {
close();
navigateToList();
}}
>
<Form
{...formProps}
layout="vertical"
onFinish={handleFinish}
>
<Form.Item label="Name" name="name" rules={[{ required: true }]}>
<Input />
</Form.Item>
</Form>
</Modal>
);
};
import { Form, Input, Modal } from "antd";
import { useModalForm } from "@refinedev/antd";
import { useGetToPath, useGo } from "@refinedev/core";
import { useSearchParams } from "react-router-dom";

export const SourceCreate = () => {

const getToPath = useGetToPath();
const [searchParams] = useSearchParams();
const go = useGo();

const { modalProps, formProps, onFinish, close, form } = useModalForm<any>({
action: "create",
resource: "sources",
defaultVisible: true,
redirect: false,
mutationMode: "pessimistic",

});

const handleFinish = async (values: any) => {
try {
await onFinish(values);

close();
navigateToList();
} catch (error) {
console.error(error);
}
};

const navigateToList = () => {
go({
to: searchParams.get("to") ?? getToPath({ action: "list" }) ?? "",
query: { to: undefined },
options: { keepQuery: true },
type: "replace",
});
};

return (
<Modal
{...modalProps}
title="Create Source"
onCancel={() => {
close();
navigateToList();
}}
>
<Form
{...formProps}
layout="vertical"
onFinish={handleFinish}
>
<Form.Item label="Name" name="name" rules={[{ required: true }]}>
<Input />
</Form.Item>
</Form>
</Modal>
);
};
When I hit save, it is giving the "Are you sure you want to leave? You have unsaved changes." alert despite actually saving.
6 replies
RRefine
Created by firm-tan on 8/11/2024 in #ask-any-question
Enabling Sorting on Antd Table
How do you set Antd sorting on a table? We are using Antd with Supabase and refine.
13 replies
RRefine
Created by adverse-sapphire on 8/6/2024 in #ask-any-question
Expo Router integration
Is there Expo Router integration?
4 replies