José Alvarez
José Alvarez
CCConvex Community
Created by José Alvarez on 10/18/2024 in #support-community
Can actions actually return a value?
thanks! that's the flow we arrived at when I discussed it with the support team via email yesterday: initial mutation: create the record schedule the background action inside the action: call apis, do anything you want call a mutation to save the results back to the original record The app is subscribed to the record via a query, so it automatically updates as you proceed.
4 replies
CCConvex Community
Created by José Alvarez on 10/17/2024 in #support-community
Advice on Convex & OpenAI Assistants API: Real-Time Reactivity, Data Redundancy, & Collaborative UX
Thank you both for the advice! I implemented Ian's approach because I do want to have full collaborative reactivity that is resilient even in the face of things like browser reload. It's working very well so far, but it does require to be careful about database bandwidth.
7 replies
CCConvex Community
Created by José Alvarez on 10/17/2024 in #support-community
Advice on Convex & OpenAI Assistants API: Real-Time Reactivity, Data Redundancy, & Collaborative UX
I also noticed Sarah Shader's example, which seems to modify Ian’s approach by using HTTP streaming while updating other users through Convex. Is the idea to use traditional HTTP streaming for the requesting user and Convex as the source of truth for others? When I tested it, the real-time reactivity felt the same across different browsers in terms of speed (if there’s a difference, I really didn’t notice). However, after reloading the requester’s browser, other users stopped receiving updates, and the completion didn’t seem to be stored in the database. If non-requester users reload, the stream resumes as expected, and real-time reactivity continues. Although this is to be expected for the reasons discussed in Ian Macartney’s article, I recommend to acknowledge trade-off in the README of Sarah Shader’s repository (and similarly, the http-streaming branch on Ian Macartney’s repo). This is a use case where I believe Convex really shines. I also came across Michal Srb’s post on "Build AI Chat With OpenAI’s Assistants API", but it feels outdated now that the Assistants API supports streaming (he used polling). Are there any newer resources or suggestions for handling similar scenarios? In brief, any tips or insights would be greatly appreciated. I also think this is a valuable use case that could be highlighted in your content marketing. Best practices on reducing data redundancy and optimal schema design for Assistants API integration would be incredibly useful. Also, I’d appreciate your thoughts on whether my concerns about data redundancy are misplaced. Should I be worried about storing too much data, or is it okay to store many columns in a table—or even the entire message object as serialized JSON in a single field? Would this impact the performance or make the database more expensive in the long run?
7 replies
CCConvex Community
Created by José Alvarez on 9/21/2024 in #support-community
Why is it that file names only appear when uploading through the console?
I may have more feedback in 1 or 2 weeks as I finish building the app I am working on, and I plan to use convex all the way for cloud storage
12 replies
CCConvex Community
Created by José Alvarez on 9/21/2024 in #support-community
Why is it that file names only appear when uploading through the console?
What I appreciated the most was the feeling that I was uploading stuff directly to Convex "through the front-end". Now this is obviously not the case, but Convex makes it so easy to set up the backend and handles it all that it was the feeling I had from a developer experience. That is a huge plus because it lets me focus on my app and not on integrating the libraries or REST APIs of other cloud providers on my backend routes
12 replies
CCConvex Community
Created by José Alvarez on 9/21/2024 in #support-community
Why is it that file names only appear when uploading through the console?
Well, if you put it that way, I guess it's not an absolute necessity. I come from a background of using Google Cloud Storage a lot, and even S3, so it's what I'm accustomed. I've even used Vercel's storage version and it works similar. But I'm guessing that if Convex wants to keep it simple, it's really not needed.
12 replies
CCConvex Community
Created by José Alvarez on 9/21/2024 in #support-community
Why is it that file names only appear when uploading through the console?
Thanks, I understand now. Wondering if you guys have considered the creation of buckets in the feature roadmap?
12 replies
CCConvex Community
Created by José Alvarez on 9/21/2024 in #support-community
Why is it that file names only appear when uploading through the console?
Convex logic (it's basically the same as the docs https://docs.convex.dev/file-storage/upload-files)
import { v } from "convex/values";
import { mutation } from "./_generated/server";

export const generateUploadUrl = mutation(async (ctx) => {
return await ctx.storage.generateUploadUrl();
});

export const sendFile = mutation({
args: { storageId: v.id("_storage"), author: v.string() },
handler: async (ctx, args) => {
await ctx.db.insert("stlFiles", {
body: args.storageId,
author: args.author,
format: "stl",
});
},
});
import { v } from "convex/values";
import { mutation } from "./_generated/server";

export const generateUploadUrl = mutation(async (ctx) => {
return await ctx.storage.generateUploadUrl();
});

export const sendFile = mutation({
args: { storageId: v.id("_storage"), author: v.string() },
handler: async (ctx, args) => {
await ctx.db.insert("stlFiles", {
body: args.storageId,
author: args.author,
format: "stl",
});
},
});
12 replies
CCConvex Community
Created by SkylerX on 11/6/2023 in #support-community
Convex + NextAUTH
I am not expert in those topics. However, webdevcody's example simply has a couple of routes (openid/token and openid/refresh) that simply revalidate the google oauth token with the front-end. This is basically what I already achieved with Google Oauth. I wonder if I could do something quite similar with email and password just to make it work with the Convex auth. Like, it doesn't have to be 100% a legitimate openid workflow with real tokens and refresh tokens—I hope—as long as the workaround is secure and lets me authenticate users.
19 replies
CCConvex Community
Created by SkylerX on 11/6/2023 in #support-community
Convex + NextAUTH
@CodingWithJamal Did you integrate it with password and email?
19 replies
CCConvex Community
Created by SkylerX on 11/6/2023 in #support-community
Convex + NextAUTH
@Michal Srb It would be great if you guys had more examples with Next Auth. For some reason, even though Next Auth is widespread, there isn't much about Convex + Next Auth on the internet. I had already found webdevcody's work on GitHub, and I used it to integrate it with the Google OAuth provider (but with the new version of Next Auth, which was actually another challenge). — Now, I would like to integrate Convex with the credentials provider (email / password) of Next Auth as well, and honestly, it's a pain. I've learned a lot about JWTs, OpenID, OAuth, etc., but it's still a challenge making sense of how I would handle the authentication provider of Convex with traditional credentials. Not all projects using Convex are side projects we can rethink and adapt to a new stack like Clerk on a weekend. Some of us are running companies and certain decisions and technical choices can't change easily, and a common one is Next Auth. This has been the biggest pain from a DX standpoint using Convex.
19 replies