RJ
RJ2mo ago

How to access deployment name inside Convex functions?

Is it possible to access the name of the current deployment (e.g. purple-dog-123) inside of a Convex function? I know that much of the time it could be parsed out of the CONVEX_SITE_URL or CONVEX_CLOUD_URL, but if you're using custom domains, these will contain the custom domain URLs, not the default https://purple-dog-123.convex.cloud or whatever.
4 Replies
Convex Bot
Convex Bot2mo 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!
Sara
Sara2mo ago
I'm not sure about the custom domain part, but try this
const convex = useConvex()

useEffect(()=>{
console.log(convex.url)
},[convex])
const convex = useConvex()

useEffect(()=>{
console.log(convex.url)
},[convex])
RJ
RJOP2mo ago
Thanks @Sara but I want the deployment name in a Convex function, not on the frontend
Sara
Sara2mo ago
Mm no clue the only thing i can think of is through environment variables

Did you find this page helpful?