Jacob Kim
Jacob Kim3w ago

Convex on my lambda

I need to ingest some data to convex. how do I authenticate convex on a lambda instance? Also would I use mutation with the client from convex/browser?
import { ConvexClient } from 'convex/browser'

const client = new ConvexClient(CONVEX_URL)

await client.mutation(api.tasks.dumpData, { data })
import { ConvexClient } from 'convex/browser'

const client = new ConvexClient(CONVEX_URL)

await client.mutation(api.tasks.dumpData, { data })
Thanks
5 Replies
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
lee
lee3w ago
Yes "convex/browser" is appropriate for lambdas. To authenticate your mutations I would 1. set a shared secret as an env variable in both convex and lambda 2. pass it as a function argument 3. validate that the argument matches the env variable
Jacob Kim
Jacob KimOP3w ago
hi thanks for the response. so I don’t need any “CONVEX PRODUCTION KEY” or anything? just my home grown auth key between the lambda and convex functions?
lee
lee3w ago
yep all exported mutation/query/action functions are available to anyone who has your .convex.cloud url. that's how the react client works when running in a browser, and similarly it's how your lambda can call them (contrast with internalMutation/internalQuery/internalAction, which can only be called by your own convex functions, or the convex dashboard or CLI)
Jacob Kim
Jacob KimOP3w ago
Oh of course! forgot that most of the convex usecase is calling from user's client. thanks for the detailed answer @Lee !

Did you find this page helpful?