oscklm
oscklm11mo ago

Cannot run yarn convex dev

I'm getting this error, but checking my schema, and everything seems fine? I tried removing the query i just added but that didn't fix it.
Error: Unable to run schema validation on https://hushed-koala-696.convex.cloud
Error fetching POST https://hushed-koala-696.convex.cloud/api/prepare_schema 400 Bad Request: InvalidSchema: Hit an error while evaluating your schema:
Invalid validator for key `json`: Not a field validator
Error: Unable to run schema validation on https://hushed-koala-696.convex.cloud
Error fetching POST https://hushed-koala-696.convex.cloud/api/prepare_schema 400 Bad Request: InvalidSchema: Hit an error while evaluating your schema:
Invalid validator for key `json`: Not a field validator
Query i added:
export const getList = zQuery({
args: {},
handler: async (ctx) => {
return ctx.db.query('channel').collect()
},
})
export const getList = zQuery({
args: {},
handler: async (ctx) => {
return ctx.db.query('channel').collect()
},
})
9 Replies
oscklm
oscklmOP11mo ago
Also, even exiting the convex dev after this with ctrl + c, the convex dev cli seems to be still running
oscklm
oscklmOP11mo ago
Here is a gif showing me exiting with ctrl + c a couple of times, and then saving the current open file with some queries. And the convex cli still seems to be running
No description
oscklm
oscklmOP11mo ago
I can force quit the node process with terminal on mac Still not able to push my schema changes with the cli though due to the error
oscklm
oscklmOP11mo ago
No description
oscklm
oscklmOP11mo ago
More context; i've just upgraded to convex 1.11 earlier today, unsure whether that could causing this. I'm gonna try downgrading Alright. Reverting the package version to 1.10 fixed the issue. Will stay on this for now
sshader
sshader11mo ago
Thanks for the bug report -- looking into it now and will update once we have a fix. Glad 1.10 is working for you in the meantime Hmm I can reproduce this schema error if I have something in my schema like myField: "foo" (instead of myField: v.literal("foo")) or myField: { foo: v.string() } (instead of myField: v.object({ foo: v.string() })). Did you have any changes to your schema when upgrading / downgrading? I can also reproduce the ctrl + c issue, but only with yarn, and can also reproduce this on 1.10 (edit: I can reproduce on 1.0.2 as well so I think we've had this bug with yarn for a while). To confirm, you're just running yarn convex dev, not a wrapper command around that?
oscklm
oscklmOP11mo ago
I did not change my schema when upgrading/downgrading no. I can post a snippet of one of my schemas in a bit. Using the zod helpers and wrapppers btw. And yes just running the convex dev command directly like that
import { zid, zodToConvex } from 'convex-helpers/server/zod'
import { defineTable } from 'convex/server'
import { z } from 'zod'

const videoSchema = z.object({
channelId: zid('channel'),

// Details
title: z.string(),
description: z.string().optional(),
tags: z.string().optional(),
category: z.string(),
thumbnailId: zid('_storage').optional(),

// Stats
likeCount: z.number(),
viewCount: z.number(),

// Settings
searchQueryText: z.string().optional(),
privacy: z.union([z.literal('public'), z.literal('private')]),
isApproved: z.boolean().optional(),
isHighlighted: z.boolean(),

// Mux data
muxData: z
.object({
assetId: z.string(),
playbackId: z.string(),
encodeStatus: z.union([z.literal('preparing'), z.literal('ready'), z.literal('errored')]),
aspectRatio: z.string(),
width: z.number(),
height: z.number(),
frameRate: z.number(),
duration: z.number(),
})
.optional(),
})

const videoFormSchema = videoSchema.omit({
likeCount: true,
viewCount: true,
searchQueryText: true,
thumbnailId: true,
muxData: true,
})
import { zid, zodToConvex } from 'convex-helpers/server/zod'
import { defineTable } from 'convex/server'
import { z } from 'zod'

const videoSchema = z.object({
channelId: zid('channel'),

// Details
title: z.string(),
description: z.string().optional(),
tags: z.string().optional(),
category: z.string(),
thumbnailId: zid('_storage').optional(),

// Stats
likeCount: z.number(),
viewCount: z.number(),

// Settings
searchQueryText: z.string().optional(),
privacy: z.union([z.literal('public'), z.literal('private')]),
isApproved: z.boolean().optional(),
isHighlighted: z.boolean(),

// Mux data
muxData: z
.object({
assetId: z.string(),
playbackId: z.string(),
encodeStatus: z.union([z.literal('preparing'), z.literal('ready'), z.literal('errored')]),
aspectRatio: z.string(),
width: z.number(),
height: z.number(),
frameRate: z.number(),
duration: z.number(),
})
.optional(),
})

const videoFormSchema = videoSchema.omit({
likeCount: true,
viewCount: true,
searchQueryText: true,
thumbnailId: true,
muxData: true,
})
Any updates on this? Just wondering when we could potentially update to 1.11 - very curious about the performance improvement on the Promise.all()
sshader
sshader11mo ago
I tried to reproduce your error with the schema you pasted and wasn't able to :/ If you're willing to share more of your schema (over DM if you prefer), I can keep looking. One potential cause of this error message could be circular imports (a.ts imports schema.ts imports a.ts, potentially with more imports in the cycle) since I think bundlers will stub out one of the imports to break the cycle (so some of the imported things could be undefined)
oscklm
oscklmOP11mo ago
Cool i've dmed you, thanks!

Did you find this page helpful?