ordering when using an index vs. without an index
useQuery
will return undefined
until it gets the first response, but shouldn't return it after that. I'm guessing you're talking about db.query...collect()
returning undefined
? If you see it again, holler!Environment variables in Convex functions
how do I use environment variables in convex functions? I tried something along these lines, but it gave me an error:
Error: [CONVEX M(user:createUser)] Uncaught ReferenceError: process is not defined
```ts
export const createUser = mutation(
async ({ db }, adminSecret: string, data: SimpleDocument<"user">) => {
if (adminSecret !== process.env.ADMIN_SECRET) {...ablobwave is there a way to perform
:ablobwave: is there a way to perform arbitrary database updates from a backend? I'm adding convex to an app that already has its own auth solution, and I'm not interested in using auth0 or openID. I just want to manage user documents manually. here's my (incomplete) code, not sure how I can get the DB here
```ts
const db = // get convex db somehow
const user = await db...
3rd party functions
Does Convex support "warm starts" for serverless external Handler functions (https://docs.convex.dev/using/external-functions)? What does the latency generally look like for these functions and is there any way to improve it?
Spread Parameter Question
const c = [s.string(), s.boolean()] as const;
s.union(...c);
const c = [s.string(), s.boolean()] as const;
s.union(...c);
Exposing ConvexAPI without using React
Separately, the type
ConvexAPI
https://docs.convex.dev/generated-api/react#convexapi that lives in _generated/react.d.ts
seems like it's not React-specific, and could perhaps be nice to extract for the use of other clientsHow InternalConvexClient types work
What exactly are
udfPath
and queryToken
in e.g. https://docs.convex.dev/api/classes/browser.InternalConvexClient#subscribe ? My guess was that udfPath
meant user-defined function path, which in turn I thought meant something like "myDir/myFile:myQuery"
. But queryToken
also sounds like it could be that.1 to Indy above if you have your own
+1 to Indy above, if you have your own node server you can also subscribe to queries just like in the browser (for realtime updates) but often the cloud polling strategy is easier to set up.
Convex on-prem or interacting with data not stored in Convex
Hello, The way I see it, the value of convex is in the computational/transactional "layer". Meaning the stored data could be hosted at the client's premisses. Most companies I worked with would never allow for their data not to be under their tight control. Maybe it'd be possible for such companies to use Convex if they host the data themselves. 99% of the interaction with that data needs to go through convex but they should still be able to host, access and query that data on their own.
For instance, company X ecomerce website/webapp uses Convex but convex itself would use company X's data center for the data storage. Obviously the stored data needs to be usable without the need for Convex. Exp: if they want to part with Convex or if they want to run some special analytics or whatever. Bottom line, company X wants to be the sole and unique holder of that data and all Convex would see is in its intermediary (maybe even ephemeral) layer!
Is such scenario possible now or in the future?...
Hello
Hello,
Can convext run on the server as well?
Say I have an app to manage my lemonstand. I'd like to have a function continouesly running on the server and subscribing through a convex-query to the amount of lemon left. If the amount decreases to some threashold, that function needs to call an external system to order more lemons.
Any limitations with runing/using Convex on the server? Maybe it requires the V8 engine?
Cheers~...
One question though When I modify the
One question though - When I modify the code on my localhost and run npm dev/npx, I observe that Convex updates the server-side code as well (AWS Lambda). Any plans to develop a fully-fledged local version/command line, so I can develop my application entirely on localhost and then deploy it to the Convex.dev platform as npx?
The localhost:3000 is forwarding the requests to Convex.dev server side. Expected it to be on my localhost as a local binary....
Schema for Record types
when defining a schema, for
s.object()
is there a way to restrict the types of values but allow any arbitrary key? e.g. the equivalent of this in typescript:
```ts
interface MyInterface {
[key: string]: number;
}...broken links
unrelated: i see some broken links in https://docs.convex.dev/using/query-and-mutation-functions#function-signatures (QueryCtx/MutationCtx)
cli.bundle.cjs is deleting itself
another thing; I seem to have to run
rm -r node_modules/
and npm i
quite often as it seems that node_modules/convex/dist/cli.bundle.cjs
is auto-deleting itself? has anyone had this issue?Schemas vs Schemaless
So I have a conceptual question about convex! I was doing the counter/messages tutorial and adding the code for the messages portion seems to break the counter portion (I haven't updated App.tsx yet, only listMessage and sendMessage)
```
convex/incrementCounter.ts:4:37 - error TS2345: Argument of type '"counter_table"' is not assignable to parameter of type '"messages"'.
4 const counterDoc = await db.query("counter_table").first();
~~~...
Hey allβI ve gotten a PoC of ProseMirror
Hey allβI've gotten a PoC of ProseMirror OT collaborative editing running on Convex!
One challenge I've run into, though, is that my Convex mutation that does the server-side rebasing of the ProseMirror document needs to import modules (e.g.
prosemirror-model
) which reference the DOM API, so I'm getting type-checking errors via e.g. npx convex dev
and npx convex deploy
. Passing a flag to turn off type-checking works fine, but I'd of course prefer not to do that.
I suppose what I'm saying I'd prefer is for type-checking of Convex functions to take into account not the modules that I'm importing, but the specific terms and types, and their dependencies. But that sounds possibly quite tricky! Any recommendations?...