Yehia
Yehia4w ago

npx convex dev problem

when ever i try to run it it gives me this i doubled checked every env var
No description
43 Replies
lee
lee4w ago
what do you have for the env var CONVEX_DEPLOYMENT
Yehia
YehiaOP4w ago
CONVEX_DEPLOYMENT=dev:example-234-22 @Lee
lee
lee4w ago
Yeah that doesn't look valid. Where did it come from? it should look like CONVEX_DEPLOYMENT=dev:wandering-fish-513 also lmk if if you have a CONVEX_DEPLOY_KEY set, since normally you don't want that to be set for npx convex dev
Yehia
YehiaOP4w ago
CONVEX_DEPLOYMENT=dev:wandering-fish-513 i have it like this yet it's not working and i don't have deply key but i tried to enable it and see and it's not working still i have a prod database it's working fine but the dev one it's the one giving me the headech and i i can't change the schema for the prod as well @Lee
lee
lee4w ago
Can you do npx convex dev --configure to reconnect it to the project
Yehia
YehiaOP4w ago
No description
Yehia
YehiaOP4w ago
but when i close it and go to use npx convex dev
Yehia
YehiaOP4w ago
No description
Yehia
YehiaOP4w ago
@lee and thanks you for your help
lee
lee4w ago
That's quite strange. Are you sure the CONVEX_DEPLOY_KEY env variable isn't set? what convex version are you using?
Yehia
YehiaOP4w ago
No description
Yehia
YehiaOP4w ago
and no i don';t have it in .env @lee
lee
lee4w ago
Can you describe more about your environment? What env vars do you have in .env and .env.local? I don't understand why it's parsing your project name as a deployment name
Yehia
YehiaOP4w ago
and i got some extra ones in prod
No description
No description
Yehia
YehiaOP4w ago
@lee
lee
lee4w ago
Are you self hosting?
Yehia
YehiaOP4w ago
no i'm using vercel
lee
lee4w ago
Oh right. Curious what DATABASE_URL is, but nothing else here should affect convex
Yehia
YehiaOP4w ago
i have two databases mongo and convex it was working but suddenly it stopped
lee
lee4w ago
and if you echo $CONVEX_DEPLOY_KEY it's empty?
Yehia
YehiaOP4w ago
yes
erquhart
erquhart4w ago
Curious, do you get any hits running this in your repo root:
grep -R --exclude-dir=node_modules ' fcit-final'
grep -R --exclude-dir=node_modules ' fcit-final'
(the space before fcit-final is intentional) Also what version of Convex are you running
Yehia
YehiaOP4w ago
\
No description
Yehia
YehiaOP4w ago
@erquhart
erquhart
erquhart4w ago
It's almost like the value of CONVEX_DEVELOPMENT is somehow including the comment. Check here: https://github.com/erquhart/convex-js/blob/3f46b0a4b174076b6baf01a25df5994f22e97727/src/cli/lib/deployment.ts#L40 If the comment is included, the value would be fcit-final, encoded to %20fcit-final I know we already asked the value of that env var, but maybe it's different somehow when the cli is reading it And if this is happening why on earth wouldn't it be happening to everyone, also. @Yehia can you get the convex version npm ls convex
lee
lee4w ago
i would also be curious if your .env.local is using a weird encoding, or something else that would make it be parsed oddly by this regex https://github.com/motdotla/dotenv/blob/59d9e8719cda45990662821823a375f4e4257073/lib/main.js#L9
Yehia
YehiaOP4w ago
sorry for being late it was the week end here in egypt however no matter fact i have the .env.local automaticly created by convex @Lee
Yehia
YehiaOP4w ago
@erquhart
No description
Yehia
YehiaOP4w ago
is there is a way to reset the whole thing i don't mind losing the dev data
lee
lee4w ago
have you tried doing an rm .env.local ? Resetting the server state doesn't seem like it would help, since the issue looks to be in your client configuration I am curious why you have two vars starting with NEXT_PUBLIC_CONVEX_ , although i don't know why that would cause this issue
Yehia
YehiaOP4w ago
@lee i did delete it and still same issue
lee
lee4w ago
Okay what if you delete the comment from the end of the line in .env.local ? (delete the hash # and everything after it) @Yehia
Yehia
YehiaOP4w ago
sorry for being late but le me try it
Yehia
YehiaOP4w ago
No description
Yehia
YehiaOP3w ago
@lee @lee it's working now i don't how but when i changed to pwsh insted of cmd it's working
lee
lee3w ago
I'm not familiar with windows shells. Can you link to the one you were using? I still don't understand why the env variable wouldn't work, but I'm glad you reached a solution
Yehia
YehiaOP3w ago
i was using windows cmd the new one is pwsh is powershell but with some extra features can i ask you something right now i have an endpoint and i want to run a mutation inside the endpoint it's an async function can you tell me how to do so cuz when i use useMutation it will tell me it can't be used inside an async function @lee
lee
lee3w ago
What kind of endpoint is this? And what kind of convex client do you have this sounds like it could be a new #support-community thread btw
Yehia
YehiaOP3w ago
i have two databases and i got a function called syncUser in convex the thing is that i'm only using convex to store admins so when creating a profile in mogodb it checks the role if it's an admin i want it ti fire up it
lee
lee3w ago
so you want to create a convex client in the mongodb endpoint? like this https://docs.convex.dev/api/classes/browser.ConvexHttpClient
Yehia
YehiaOP3w ago
more like this
No description
lee
lee3w ago
this sounds like a good candidate for another #support-community or #ask-ai thread
Yehia
YehiaOP3w ago
thanks for your time btw

Did you find this page helpful?