Sitruc
CCConvex Community
•Created by Sitruc on 5/10/2024 in #support-community
ArgumentValidationError
I'm getting the following error
However I'm confused if this is refering to the handler or the schema itself.
My handler looks like this which has the optional wrapped around the arg
ArgumentValidationError: Object is missing the required field `userId`. Consider wrapping the field validator in `v.optional(...)` if this is expected.
Object: {}
Validator: v.object({userId: v.id("users")})
ArgumentValidationError: Object is missing the required field `userId`. Consider wrapping the field validator in `v.optional(...)` if this is expected.
Object: {}
Validator: v.object({userId: v.id("users")})
export const get = query({
args: {
userId: v.optional(v.id('users')),
},
handler: async (ctx, args) => {
if (args.userId === undefined) {
return [];
}
return await ctx.table('tableName').filter((q) => q.eq(q.field('userId'), args.userId));
},
});
export const get = query({
args: {
userId: v.optional(v.id('users')),
},
handler: async (ctx, args) => {
if (args.userId === undefined) {
return [];
}
return await ctx.table('tableName').filter((q) => q.eq(q.field('userId'), args.userId));
},
});
3 replies
CCConvex Community
•Created by Sitruc on 5/5/2024 in #support-community
I recently switched to Convex-ents and have TS errors
node_modules/convex-ents/dist/schema.d.ts:261:41 - error TS1109: Expression expected.
261 deletion(type: "scheduled", options?: {
~
node_modules/convex-ents/dist/schema.d.ts:262:24 - error TS1005: ',' expected.
262 delayMs: number;
~
node_modules/convex-ents/dist/schema.d.ts:263:7 - error TS1005: ';' expected.
263 }): EntDefinition<Document & {
~
node_modules/convex-ents/dist/schema.d.ts:266:1 - error TS1128: Declaration or statement expected.
266 }
~
Found 81 errors in the same file, starting at: node_modules/convex-ents/dist/schema.d.ts:70
node_modules/convex-ents/dist/schema.d.ts:261:41 - error TS1109: Expression expected.
261 deletion(type: "scheduled", options?: {
~
node_modules/convex-ents/dist/schema.d.ts:262:24 - error TS1005: ',' expected.
262 delayMs: number;
~
node_modules/convex-ents/dist/schema.d.ts:263:7 - error TS1005: ';' expected.
263 }): EntDefinition<Document & {
~
node_modules/convex-ents/dist/schema.d.ts:266:1 - error TS1128: Declaration or statement expected.
266 }
~
Found 81 errors in the same file, starting at: node_modules/convex-ents/dist/schema.d.ts:70
{
"compilerOptions": {
"allowJs": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext", "DOM"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"pretty": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2018",
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".graphqlrc.ts", ".graphql-codegen,json"],
"exclude": ["node_modules/*"]
}
{
"compilerOptions": {
"allowJs": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext", "DOM"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"pretty": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2018",
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".graphqlrc.ts", ".graphql-codegen,json"],
"exclude": ["node_modules/*"]
}
2 replies
CCConvex Community
•Created by Sitruc on 4/30/2024 in #support-community
Error whilst trying to setup local dev on M2 MBP
3 replies