Remy Oreo
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
It will surely be helpful to make the error more obvious..
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
crazy!! i cant believe i have been checking a different function all this while... Thanks..
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
do i change it only in schema or also in my mutation function
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
Oh okay i will do that.
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
please how do you mean specifically, How do i make that work
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
here is my github repo:
https://github.com/Oreolion/ra-ai-powered-blogging-platform
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
yeah sure
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
export const createPost = mutation({
args: {
// audioStorageId: v.union(v.id("_storage"), v.null()),
// audioStorageId: v.optional(v.union(v.id("_storage"), v.null())),
// audioStorageId: v.optional(v.union(v.null(), v.id("_storage"))),
audioStorageId: v.optional(v.any()),
postTitle: v.string(),
postDescription: v.string(),
// audioUrl: v.string(),
imageUrl: v.string(),
imageStorageId: v.union(v.id("_storage"), v.null()),
postContent: v.string(),
imagePrompt: v.string(),
postCategory: v.string(),
views: v.number(),
likes: v.number(),
// audioDuration: v.number(),
},
handler: async (ctx, args) => {
const identity = await ctx.auth.getUserIdentity();
if (!identity) {
throw new ConvexError("User not authenticated");
}
const user = await ctx.db
.query("users")
.filter((q) => q.eq(q.field("email"), identity.email))
.collect();
if (user.length === 0) {
throw new ConvexError("User not found");
}
return await ctx.db.insert("posts", {
audioStorageId: args.audioStorageId,
user: user[0]._id,
postTitle: args.postTitle,
postDescription: args.postDescription,
audioUrl: args.audioUrl,
imageUrl: args.imageUrl,
imageStorageId: args.imageStorageId,
author: user[0].name,
authorId: user[0].clerkId,
postContent: args.postContent,
imagePrompt: args.imagePrompt,
postCategory: args.postCategory,
views: args.views,
likes: args.likes,
authorImageUrl: user[0].imageUrl,
audioDuration: args.audioDuration,
});
},
});
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
okay so we do this one step at a time, when i added v.optional(v.any()) as you mentioned:
i got the the last error i sent,
here is the schema:
import { defineSchema, defineTable } from "convex/server";
import { v } from "convex/values";
export default defineSchema({
posts: defineTable({
user: v.id("users"),
postTitle: v.string(),
postContent: v.string(),
postCategory: v.string(),
postDescription: v.string(),
audioUrl: v.optional(v.string()),
imageStorageId: v.optional(v.id("_storage")),
// audioStorageId: v.optional(v.union(v.id("_storage"), v.null())),
// audioStorageId: v.union(v.id("_storage"), v.null()),
// audioStorageId: v.any(),
// audioStorageId: v.optional(v.union(v.null(), v.id("_storage"))),
audioStorageId: v.optional(v.any()),
author: v.string(),
authorId: v.string(),
authorImageUrl: v.string(),
imageUrl: v.string(),
imagePrompt: v.string(),
// audioDuration: v.number(),
views: v.number(),
likes: v.optional(v.number()),
})
.searchIndex("search_author", {searchField: "author"})
.searchIndex("search_title", {searchField: "postTitle"})
.searchIndex("search_body", {searchField: "postDescription"}),
users: defineTable({
email: v.string(),
imageUrl: v.string(),
clerkId: v.string(),
name: v.string(),
}),
// ... your existing tables ...
comments: defineTable({
postId: v.id("posts"),
userId: v.id("users"),
content: v.string(),
createdAt: v.number(),
}).index("by_post", ["postId"]),
});
here is the convex function to add function:
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
so i got that new error when i tried v.optional(v.any())
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
✖ Schema validation failed
Document with ID "jh747tjvj7bs5p1tanj01g55ad6wkzdv" in table "posts" does not match the schema: Object contains extra field
audioStorageId
that is not in
the validator.
Object: {audioStorageId: null, author: "RA", authorId: "user_2im6tAuMCHdIPR5e28RGNxejLKA", authorImageUrl: "https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvb2F1dGhfZ29vZ2xlL2ltZ18yaW02dEZXYkRIY2p1ZURCTmIyRUhWbGNlOVMifQ", imagePrompt: "", imageStorageId: "kg25nz5y24pvjaec8bypr65cw96wj1va", imageUrl: "https://judicious-gazelle-541.convex.cloud/api/storage/0c19c4ef-42c4-493d-aba6-ac7471af0cf2", likes: 0.0, postCategory: "Artificial Intelligence", postContent: "THIS IS A TEST POST, THIS IS A TEST POST, THIS IS A TEST POST", postDescription: "THIS IS A TEST POST", postTitle: "first post", user: "jd7e3hpyceka0d29ver6a79n4x6w81pr", views: 0.0}
Validator: v.object({audioUrl: v.optional(v.string()), author: v.string(), authorId: v.string(), authorImageUrl: v.string(), imagePrompt: v.string(), imageStorageId: v.optional(v.id("_storage")), imageUrl: v.string(), likes: v.optional(v.float64()), postCategory: v.string(), postContent: v.string(), postDescription: v.string(), postTitle: v.string(), user: v.id("users"), views: v.float64()})52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
okay, trying that now
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
ohh i see..
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
Filesystem changed during push, retrying...
✔ Schema validation complete.
Downloading current deployment state...
Diffing local code and deployment state
Analyzing and deploying source code...
✖ Error: Unable to push deployment config to https://judicious-gazelle-541.convex.cloud
Error fetching POST https://judicious-gazelle-541.convex.cloud/api/push_config 400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Unable to parse JSON from
exportArgs
: Error in args validator: Invalid validator for key audioStorageId
: Not a field validator
See https://docs.convex.dev/functions/validation for docs on how to do argument validation.52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
i think that is the main issue, which led to code to break completely as it disconnect my codebase from convex
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard

52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
Okay trying that now..
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
i guess it happened because audioStorageId was already saved as null..
52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
tried changing the validaot for the key to audioStorageId: v.optional(v.string()),
which triggers a new error that:
npx convex dev
(node:20668) [DEP0040] DeprecationWarning: The
punycode
module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ...
to show where the warning was created)
✖ Schema validation failed
Document with ID "jh747tjvj7bs5p1tanj01g55ad6wkzdv" in table "posts" does not match the schema: Value does not match validator.
Path: .audioStorageId
Value: null
Validator: v.id("_storage")52 replies
CCConvex Community
•Created by Remy Oreo on 7/25/2024 in #support-community
schema failed to update in dashboard
i have been thinking its a cache issue but not sure, maybe their is a command to clear the cache
52 replies