nikiv.dev
nikiv.dev17h ago

how to avoid CORS on convex functions

how to avoid CORS on convex functions I have SITE_URL set correctly
61 Replies
nikiv.dev
nikiv.devOP17h ago
No description
nikiv.dev
nikiv.devOP17h ago
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 cors
nikiv.dev
nikiv.devOP17h ago
actually all requests do this https://gen.new/
No description
nikiv.dev
nikiv.devOP17h ago
ok checking, maybe i need to add something to requests oo i think in convex dash i need to have approved domains most likely
nikiv.dev
nikiv.devOP17h ago
ok that seems pro plan only feature
No description
nikiv.dev
nikiv.devOP16h ago
in theory
No description
nikiv.dev
nikiv.devOP16h ago
this should be a fix against cors as I am making requests from that origin
erquhart
erquhart16h ago
Using Better Auth? There's a Convex integration for it, unless you're intentionally rolling your own
nikiv.dev
nikiv.devOP16h ago
yea I am using better auth
erquhart
erquhart16h ago
Not using the Convex + Better Auth component on purpose?
nikiv.dev
nikiv.devOP16h ago
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.
nikiv.dev
nikiv.devOP16h ago
let me check the auth part
erquhart
erquhart16h ago
Ah looking at the starter you linked in the readme
nikiv.dev
nikiv.devOP16h ago
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
erquhart
erquhart16h ago
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
nikiv.dev
nikiv.devOP16h ago
i tried on gen.new dev. was old thing let me check maybe i have it in code defined
nikiv.dev
nikiv.devOP16h ago
nop
No description
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP16h ago
in vercel
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP16h ago
favicon will fix now where did you see dev.gen.new i thought i removed all traces of it that was just a test subdomain
nikiv.dev
nikiv.devOP16h ago
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 dash
erquhart
erquhart16h ago
Check your logs in the convex dashboard, there may be some clues there
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP16h ago
or there are other logs
nikiv.dev
nikiv.devOP16h ago
No description
erquhart
erquhart16h ago
Click logs on the left
nikiv.dev
nikiv.devOP16h ago
oo til
nikiv.dev
nikiv.devOP16h ago
mm
No description
erquhart
erquhart16h ago
Have you run convex dev yet
nikiv.dev
nikiv.devOP16h ago
i commit generated files
erquhart
erquhart16h ago
yeah you're supposed to
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP16h ago
should i maybe
erquhart
erquhart16h ago
Yeah you need to run convex dev
nikiv.dev
nikiv.devOP16h ago
change build to run npx convex dev && bun run build?
erquhart
erquhart16h ago
First, is this happening in dev
nikiv.dev
nikiv.devOP16h ago
dev is ok no errors
erquhart
erquhart16h ago
Or working in dev and only failing in production ah
nikiv.dev
nikiv.devOP16h ago
its only in prod its failing "build": "vite build", is my build now
nikiv.dev
nikiv.devOP16h ago
yea i read this doc and followed it like i have CONVEX_DEPLOY_KEY
erquhart
erquhart16h ago
The build command Template doesn't have a production build command, you need to follow all the steps in the doc there
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP16h ago
oh so you mean override build in vercel i remember trying this and i was getting issues ok let me try again
nikiv.dev
nikiv.devOP16h ago
woow
No description
nikiv.dev
nikiv.devOP16h ago
no cors any more only email doesn't send tho mm but will debug that now thanks a lot @erquhart
erquhart
erquhart16h ago
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
nikiv.dev
nikiv.devOP16h ago
no emails sent from resend, its like its not even reaching it also i dont get why
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP16h ago
but no logs reach vercel for some reason for my other projects everything is ok super weird
nikiv.dev
nikiv.devOP16h ago
No description
nikiv.dev
nikiv.devOP15h ago
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)
nikiv.dev
nikiv.devOP15h ago
No description
nikiv.dev
nikiv.devOP10h ago
ok i think i get it
No description
nikiv.dev
nikiv.devOP10h ago
in here I don't actually set from what email it should send it from
No description
nikiv.dev
nikiv.devOP10h ago
No description
nikiv.dev
nikiv.devOP10h ago
although maybe SITE_URL would be used i'd think

Did you find this page helpful?