how to avoid CORS on convex functions
how to avoid CORS on convex functions
I have
SITE_URL
set correctly61 Replies

I have a request being made to
'https://charming-raccoon-146.convex.site/api/auth/email-otp/send-verification-otp
from my client but its blocked by corsactually all requests do this
https://gen.new/

ok checking, maybe i need to add something to requests
oo
i think in convex dash i need to have approved domains most likely
ok that seems pro plan only feature

in theory

this should be a fix against cors
as I am making requests from that origin
Using Better Auth? There's a Convex integration for it, unless you're intentionally rolling your own
yea I am using better auth
Not using the Convex + Better Auth component on purpose?
GitHub
GitHub - genxai/new: Generate anything. Personalized. Any model.
Generate anything. Personalized. Any model. Contribute to genxai/new development by creating an account on GitHub.
let me check the auth part
Getting Started | Convex + Better Auth
Getting Started with Better Auth and Convex
Ah looking at the starter you linked in the readme
yea i also asked @Topf
maybe he knows
i assumed he used that
but i added the envs proper
to vercel that is
and convex dash
Yep it's using it, and it appears to be set up correctly to avoid cors issues
rereading your messages here
Just looking at your screenshot, you put gen.new as SITE_URL, but the error you shared says your domain is dev.gen.new
i tried on gen.new
dev. was old thing
let me check
maybe i have it in code defined
nop


in vercel


favicon will fix now
where did you see
dev.gen.new
i thought i removed all traces of it
that was just a test subdomainThe errors in your screenshots https://discord.com/channels/1019350475847499849/1420203995540095108/1420204025210736753
a true
ok yea that was old screen
https://gen.new/
you can replicate cors here too
and thats with all sites pointing to
gen.new
by sites i mean vercel and convex dashCheck your logs in the convex dashboard, there may be some clues there

or there are other logs

Click logs on the left
oo til
mm

Have you run convex dev yet
i commit generated files
yeah you're supposed to

should i maybe
Yeah you need to run convex dev
change build
to run
npx convex dev && bun run build
?First, is this happening in dev
dev is ok
no errors
Or working in dev and only failing in production
ah
its only in prod its failing
"build": "vite build",
is my build nowyea i read this doc and followed it
like i have
CONVEX_DEPLOY_KEY
The build command
Template doesn't have a production build command, you need to follow all the steps in the doc there

oh so you mean override build in vercel
i remember trying this and i was getting issues
ok let me try again
woow

no cors any more
only email doesn't send tho mm
but will debug that now
thanks a lot @erquhart
Check your resend dashboard, might be in test mode attempting to send to an email address other than the one you're allowed to use for test
no emails sent from resend, its like its not even reaching it
also i dont get why

but no logs reach vercel for some reason
for my other projects everything is ok
super weird

it seems its because i need some kind of vercel adapter on top of react or smth
its strange tho cause i remember vercel being able to consume any browser logs
ok going to fix the logs issue first, then why resend is not sending mails (i think it just doesn't reach it)

ok i think i get it

in here I don't actually set from what email it should send it from


although maybe
SITE_URL
would be used i'd think