punn
punn
CCConvex Community
Created by punn on 8/3/2024 in #support-community
Zod convex helpers build error
Getting this error when running npm run build on nextjs app
Type error: Type '{ [Index in keyof T]: T[Index] extends ZodTypeAny ? ConvexValidatorFromZod<T[Index]> : never; }' does not satisfy the constraint 'Validator<any, "required", any>[]'.
Types of property 'length' are incompatible.
Type 'T["length"] extends ZodTypeAny ? ConvexValidatorFromZod<T["length"]> : never' is not assignable to type 'number'.
Type 'ConvexValidatorFromZod<T["length"]>' is not assignable to type 'number'.
Type 'VId<Id<string>, "required"> | (T["length"] extends ZodString ? VString<string, "required"> : T["length"] extends ZodNumber ? VFloat64<...> : T["length"] extends ZodNaN ? VFloat64<...> : T["length"] extends ZodBigInt ? VInt64<...> : T["length"] extends ZodBoolean ? VBoolean<...> : T["length"] extends ZodNull ? VNull<...' is not assignable to type 'number'.
Type 'VId<Id<string>, "required">' is not assignable to type 'number'.
Type 'VId<Id<string>, "required">' is not assignable to type 'number'.

531 | ? VUnion<
532 | ConvexValidatorFromZod<T[number]>["type"],
> 533 | {
| ^
534 | [Index in keyof T]: T[Index] extends z.ZodTypeAny
535 | ? ConvexValidatorFromZod<T[Index]>
Linting and checking validity of type
Type error: Type '{ [Index in keyof T]: T[Index] extends ZodTypeAny ? ConvexValidatorFromZod<T[Index]> : never; }' does not satisfy the constraint 'Validator<any, "required", any>[]'.
Types of property 'length' are incompatible.
Type 'T["length"] extends ZodTypeAny ? ConvexValidatorFromZod<T["length"]> : never' is not assignable to type 'number'.
Type 'ConvexValidatorFromZod<T["length"]>' is not assignable to type 'number'.
Type 'VId<Id<string>, "required"> | (T["length"] extends ZodString ? VString<string, "required"> : T["length"] extends ZodNumber ? VFloat64<...> : T["length"] extends ZodNaN ? VFloat64<...> : T["length"] extends ZodBigInt ? VInt64<...> : T["length"] extends ZodBoolean ? VBoolean<...> : T["length"] extends ZodNull ? VNull<...' is not assignable to type 'number'.
Type 'VId<Id<string>, "required">' is not assignable to type 'number'.
Type 'VId<Id<string>, "required">' is not assignable to type 'number'.

531 | ? VUnion<
532 | ConvexValidatorFromZod<T[number]>["type"],
> 533 | {
| ^
534 | [Index in keyof T]: T[Index] extends z.ZodTypeAny
535 | ? ConvexValidatorFromZod<T[Index]>
Linting and checking validity of type
1 replies
CCConvex Community
Created by punn on 3/6/2024 in #support-community
400 on dev push
No description
13 replies
CCConvex Community
Created by punn on 2/23/2024 in #support-community
Websocket endpoint
Hi all, is it possible to expose a websocket endpoint in Convex? Code snippet from express we're trying to emulate
import { RawData, WebSocket } from "ws";
import { Request } from "express";

var express = require('express');
var app = express();
var expressWs = require('express-ws')(app);
const port = 3000

// Your other API endpoints
app.get('/', (req, res) => {
res.send('Hello World!')
})

app.ws("/llm-websocket/:call_id",
async (ws: WebSocket, req: Request) => {
// callId is a unique identifier of a call, containing all information about it
const callId = req.params.call_id;

ws.on("error", (err) => {
console.error("Error received in LLM websocket client: ", err);
});
ws.on("message", async (data: RawData, isBinary: boolean) => {
// Retell server will send transcript from caller along with other information
// You will be adding code to process and respond here
});
},
);

app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
});
import { RawData, WebSocket } from "ws";
import { Request } from "express";

var express = require('express');
var app = express();
var expressWs = require('express-ws')(app);
const port = 3000

// Your other API endpoints
app.get('/', (req, res) => {
res.send('Hello World!')
})

app.ws("/llm-websocket/:call_id",
async (ws: WebSocket, req: Request) => {
// callId is a unique identifier of a call, containing all information about it
const callId = req.params.call_id;

ws.on("error", (err) => {
console.error("Error received in LLM websocket client: ", err);
});
ws.on("message", async (data: RawData, isBinary: boolean) => {
// Retell server will send transcript from caller along with other information
// You will be adding code to process and respond here
});
},
);

app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
});
9 replies
CCConvex Community
Created by punn on 1/24/2024 in #support-community
loadMore with usePaginatedQuery
I'm stumbling into some issues with loadMore and the usePaginatedQuery hook. We call loadMore when pressing a button. We log the click and loadMore is called, but we have to call it 3 times before getting the first few elements. initialNumItems is 2, and we're calling loadMore(4). This doesn't seem to be transient since it requires 4 total calls to loadMore before it actually loads additional items.
5 replies
CCConvex Community
Created by punn on 12/28/2023 in #support-community
production vector store
Currently debating between the convex built-in vector store and more conventional options (pinecone, chroma, etc.). Any thoughts?
3 replies
CCConvex Community
Created by punn on 12/22/2023 in #support-community
The right way to use makeFunctionReference
I'd like to create a function reference and store it in a array (while outside of the client), and use a client to consume the references and make the fn calls. what's the best way to do this?
8 replies
CCConvex Community
Created by punn on 9/20/2023 in #support-community
Scheduled Function Error
We're occasionally getting a Cannot invoke syscall during module imports on our scheduled action.
3 replies
CCConvex Community
Created by punn on 9/18/2023 in #support-community
Efficient backfills
Is there a more efficient backfill than this approach? (backfilling info directly throws the function read limit error)
backfillForAllUsers:
users = all users
for user in users:
schedule backfillForOneUser

backfillForOneUser:
infos = this user's info[]
for info in infos:
patch info
backfillForAllUsers:
users = all users
for user in users:
schedule backfillForOneUser

backfillForOneUser:
infos = this user's info[]
for info in infos:
patch info
6 replies
CCConvex Community
Created by punn on 9/8/2023 in #support-community
Lifetime of logs
Is there a plan to store logs over a large time window? This would be especially useful for failures/errors thats we want to loop back on but didn't have a chance to tackle immediately
2 replies
CCConvex Community
Created by punn on 9/1/2023 in #support-community
Slack Bolt
Is it possible to host a Slack app using Slack Bolt on Convex?
3 replies
CCConvex Community
Created by punn on 9/1/2023 in #support-community
Mutations race condition
I have a table called messageBuffer that does the following: - Creates a new row for some conversation's first message - If another message in the conversation arrives, we append a buffer variable within that conversation's row - After 30 seconds, each message in buffer is processed, and the row is deleted (note: this deletion happens in an action that takes a long time to execute). I'm currently running into the issue of losing message_2 in the following scenario: for one conversation, message_1 arrives 30 seconds pass and we begin to process and flush the buffer message_2 arrives buffer is deleted message_3 arrives ..... Am I able to fix this by replacing my deletion with an updateOrDelete function instead?
8 replies
CCConvex Community
Created by punn on 8/18/2023 in #support-community
Compliance timelines
Hi, are there any updates on compliance timelines? We have several high-ticket customers from the EU that we aren't able to serve due to lack of GDPR compliance. Thanks!
3 replies
CCConvex Community
Created by punn on 8/14/2023 in #support-community
Run Mutation based on successful jobs
We have an import flow for our Airbnb App that imports multiple pieces of data, namely: - Listings - Reservations for each listing - Conversations for each reservation - Messages for each conversation When a user imports a listing, we run action to fetch listings, reservations, conversations, and messages. After fetching listings and reservations (not using the scheduler), we use the reservationIds to schedule actions to fetch conversations and messages. We update the user's subscription details after the function calls to schedule these actions. So if these scheduled actions fail, we still update the subscription anyways. How should we go about updating the subscription only after the actions are successful and not when they fail?
3 replies
CCConvex Community
Created by punn on 8/5/2023 in #support-community
Querying _creationTime range in large table
What are the suggested patterns for querying a large table by _creationTime? I would like to specify a startTime and endTime but my current query still iterates over the whole table, which exceeds the limit and throws an error.
4 replies
CCConvex Community
Created by punn on 8/2/2023 in #support-community
Data not loading on dashboard
Hey all, For some reason, my tables are taking a long time to load on my dashboard. just spins and is stuck there
20 replies
CCConvex Community
Created by punn on 7/27/2023 in #support-community
Data privacy compliance
Which privacy laws are Convex currently compliant with? I remember that Convex still isn't GDPR compliant. But I was wondering if there are others still WIP too.
6 replies
CCConvex Community
Created by punn on 7/25/2023 in #support-community
Schema Validation
Can a null value not be passed to v.optional(v.number())?
2 replies
CCConvex Community
Created by punn on 7/19/2023 in #support-community
Will NodeJS runtime in http.ts be supported?
I'm doing request validation for webhooks and need to use some libraries in http.ts I can't pass the request to the action since Fetch API objects aren't supported datatypes
16 replies
CCConvex Community
Created by punn on 7/13/2023 in #support-community
Timeout after 30 seconds on mutation
{"code":"RequestTimeout","message":"InternalServerError: Your request timed out."}
{"code":"RequestTimeout","message":"InternalServerError: Your request timed out."}
Getting this timeout well before the expected timeout (1 minute?). Is there a way to extend the timeout? Also, this was working for other scheduled actions that ran for much longer
27 replies
CCConvex Community
Created by punn on 7/8/2023 in #support-community
Error Tracking
Is there a way to wrap all actions to perform another action (i.e. send a slack message) when errors are thrown?
4 replies