nikiv.dev
nikiv.dev18h ago

I get a very strange error in production

I get a very strange error in production but I don't get how to get its logs, vercel doesn't show anything convex dashboard doesn't show anything in its functions too anyone know what I can do in such cases?
No description
55 Replies
nikiv.dev
nikiv.devOP18h ago
this only happens in production
Slimy
Slimy18h ago
I think you imported an Convex server function into the client
nikiv.dev
nikiv.devOP18h ago
nikiv.dev
nikiv.devOP18h ago
nikiv.dev
nikiv.devOP18h ago
interesting, can you help understand where I can import it https://github.com/genxai/new im checking sign-in route now
Slimy
Slimy18h ago
Can't find the root cause but I would check in local env, I had this issues once and my console was getting error log. I'd start debugging from there.
nikiv.dev
nikiv.devOP18h ago
is there env responsible for server fn in convex mby i missed adding it in vercel but I think I added everything
nikiv.dev
nikiv.devOP18h ago
oh this doc I read, I think I got all envs from there
nikiv.dev
nikiv.devOP18h ago
ok i think that maybe the cause as I do use custom domain
No description
nikiv.dev
nikiv.devOP18h ago
checking it more now only thing its unclear what CONVEX_CLOUD_URL should be
Sara
Sara18h ago
Hi, I don't know who wrote the entire repo, but when I first saw it, to me it looked like an AI wrote the entire thing, This is why i seriously recommend that you learn what you're doing before implementing it, at least by a little bit.. Learn how to debug things, we tend to help out with things in a smaller area, things this big (and hard to debug) would be recommended to hire somebody.. please take this with a grain of salt
nikiv.dev
nikiv.devOP18h ago
oh I didn't know it was AI written I just found it from #hackathon and it looked like it had auth working which is what I needed and in my local tests auth worked I essentially needed a starter with better auth
Slimy
Slimy18h ago
Pretty sure this uses Convex Auth and not Better Auth I saw useConvextAuth somewhere
nikiv.dev
nikiv.devOP18h ago
No description
Slimy
Slimy18h ago
Could be massively outdated.
Sara
Sara18h ago
I'm sure it worked, it has way to much issues in prod, this is why i mentioned to debug it locally first
nikiv.dev
nikiv.devOP18h ago
the problem is that this issue only appears in production locally full flow works thats why I asked how to debug as I can't get logs
Sara
Sara18h ago
Run npm build And start fixing what ever causes it to fail
nikiv.dev
nikiv.devOP18h ago
npm build passes
Sara
Sara18h ago
For convex? Let me read the docs
nikiv.dev
nikiv.devOP18h ago
its runtime error
Sara
Sara18h ago
There's no way it runs
Slimy
Slimy18h ago
@Sara do you have a sec ? I have question about deployments.
nikiv.dev
nikiv.devOP18h ago
No description
nikiv.dev
nikiv.devOP18h ago
or what do you mean
Sara
Sara18h ago
Give me a moment, imma try to run it on my end
nikiv.dev
nikiv.devOP18h ago
are envs i have in prod for ref
No description
nikiv.dev
nikiv.devOP18h ago
it might be I miss some env for convex fn
nikiv.dev
nikiv.devOP18h ago
@Sara can pull, i just pushed a commit to simplify auth to only otp not that it is relevant to the issue but i didn't need the other stuff thank you lots for the help ❤️
Sara
Sara18h ago
I won't be spending more than 20 min on this
nikiv.dev
nikiv.devOP18h ago
yea ofc
Sara
Sara18h ago
you're on your own after that
nikiv.dev
nikiv.devOP18h ago
i really just need a way to get runtime logs somehow if its convex fn failing
nikiv.dev
nikiv.devOP18h ago
No description
nikiv.dev
nikiv.devOP18h ago
its strange as dash makes it seem like no fn are deployed even
nikiv.dev
nikiv.devOP18h ago
and vercel doesn't show logs too strangely
No description
Sara
Sara17h ago
I've already spotted soooo many problems: 1. tests need to be run in a seperate folder, and not just for "snapshots" or to make sure that a component mounts, because it always mounts 😅 2. the eslint has some bad rules like turning off the any type error, and using a deprecated config, 3. somehow, you've turned off everything that shows you the errors and helps you fix them, and it's causing both local and build to pass, but when you do anything (say interact with pages) you get type errors almost instantly
nikiv.dev
nikiv.devOP17h ago
oo the eslint turn of is super bad indeed I mentioned it to @Topf ok i will sort eslint for now
Sara
Sara17h ago
also, Sometimmes it helps to read the error
No description
nikiv.dev
nikiv.devOP17h ago
No description
Sara
Sara17h ago
and to make it make sense, in this case you'd use a link and give it the buttonVariants property
nikiv.dev
nikiv.devOP17h ago
but this issue seems like it happens in convex function? i think it is checking for session and is failing in production env only
Sara
Sara17h ago
you might not have the enviroment variables for the config defined its failing immediatly because of it
nikiv.dev
nikiv.devOP17h ago
Custom Domains & Hosting | Convex Developer Hub
Serve requests from any domains and host your frontend on any static hosting provider, such as GitHub.
nikiv.dev
nikiv.devOP17h ago
i set all the envs asked here also the envs i have in vercel are same ones in localhost (diff values only) i checked .env.local*
Sara
Sara17h ago
but if you read the .env.example there's additional env variables that you need to define or set the default to false
nikiv.dev
nikiv.devOP17h ago
ok yea i see BETTER_AUTH_SECRET=REPLACE_WITH_32_CHAR_SECRET ok will set it all up now, thank you
Sara
Sara17h ago
you have other variables too .. if you read the function, you can figure out which ones' you need to set, hint: the github, apple, google, etc ones
nikiv.dev
nikiv.devOP17h ago
ok this makes sense
Sara
Sara17h ago
good luck, I'm heading off to bed now. read the code before you judge the element
nikiv.dev
nikiv.devOP17h ago
good night and thanks a lot yea will do
Topf
Topf11h ago
I’d recommend reading the Readme for a start. It’s not overly extensive (I just factored this code out of another project I am using Better Auth for), but it does contain a lot of the information you have been seeking, including the variables: https://github.com/Topfi/BetterAuth-Convex-9ui-shadcn-CLI-/blob/main/README.md
GitHub
BetterAuth-Convex-9ui-shadcn-CLI-/README.md at main · Topfi/Better...
🔐 A polished Better Auth + Convex setup with React 19 & Vite. Full auth flows (magic links, OTP, TOTP, social sign-in), strong security, styled UI, & realtime sync. Perfect for MVPs...
nikiv.dev
nikiv.devOP10h ago
yea I read the readme twice now but it doesn’t say much about resend except that you can set the env for resend and that emails would work in production i am now writing a helper so that logs happen on the server as that’s the only way vercel can see logs because it’s unclear to me why resend logic would not activate i don’t think i changed that part of the flow and left it as is i only removed magic links to simplify as I just want to have OTP code sending i also double checked that resend credentials are correct too so issue is not there that’s for this issue https://discord.com/channels/1019350475847499849/1420203995540095108 the variables issue is solved, apologize for missing parts of the readme at the time ok I think I know the cause of the bug now but it's unclear to me how the email from its sending from is chosen, shared more in https://discord.com/channels/1019350475847499849/1420203995540095108/1420304551906381836

Did you find this page helpful?