Could not find public function for 'chats:create'. Did you forget to run `npx convex dev` or `npx co

I get this error:
Could not find public function for 'chats:create'. Did you forget to run npx convex dev or npx convex deploy?
I searched for it on this Discord & it goes back to 2023 but didn't find a solution for it. Basically what I did was clone convex version of Trello (Tanstack Start) and then changed my schema of that Trello to something else (lets say Notes) and then when I tried to redeploy it, it started giving errors. Now my deploy table is of the old Trello stack rather than my new notes app. How do I solve it? I just want it to re-use my new schema? Bdw my CONVEX_DEPLOYMENT & VITE_CONVEX_URL are 2 different URLs.
No description
107 Replies
Sara
Sara•12h ago
well, are you running bunx convex dev?
Startup Spells šŸŖ„ Newsletter Guy
Yes
"scripts": {
"dev": "concurrently -r bun:dev:web bun:dev:convex",
"dev:web": "vite dev --port 5173",
"dev:convex": "convex dev",
"dev:convex:logs": "convex dev --tail-logs always",
"convex:deploy": "convex deploy -v",
"convex:codegen": "convex codegen",
"convex:dashboard": "convex dashboard",
"build": "vite build && tsc --noEmit",
"start": "vite preview --port 5173",
"ts:check": "tsc --noEmit",
"clean": "rimraf dist"
},
"scripts": {
"dev": "concurrently -r bun:dev:web bun:dev:convex",
"dev:web": "vite dev --port 5173",
"dev:convex": "convex dev",
"dev:convex:logs": "convex dev --tail-logs always",
"convex:deploy": "convex deploy -v",
"convex:codegen": "convex codegen",
"convex:dashboard": "convex dashboard",
"build": "vite build && tsc --noEmit",
"start": "vite preview --port 5173",
"ts:check": "tsc --noEmit",
"clean": "rimraf dist"
},
Sara
Sara•12h ago
yep, run with "x" to update the api and such
Startup Spells šŸŖ„ Newsletter Guy
I run bun run dev but I also ran dev:web & dev:convex in 2 different terminals
Sara
Sara•12h ago
I don't have much experience with bun myself, but try it with bunx
Startup Spells šŸŖ„ Newsletter Guy
I tried bunx too but that doesnt' do anything different than just using the above script bun is just like npm. bun/bunx = npm/npx it has nothing to do with this error tho i just cant seem to update the schema
Startup Spells šŸŖ„ Newsletter Guy
see my functions are of the trellaux (trello clone) here
No description
Startup Spells šŸŖ„ Newsletter Guy
even tho i changed my schema completely
Sara
Sara•12h ago
that's a pretty broad statement
Sara
Sara•12h ago
I am not a miracle worker, but can we take this one step at a time so I can understand what the root of the problem is?
Sara
Sara•12h ago
also are you new to convex?
Startup Spells šŸŖ„ Newsletter Guy
yep the problem is: 1. i cloned https://github.com/TanStack/router/tree/main/examples/react/start-convex-trellaux 2. updated deps to latest 3. changed the trello project to my new notes app 4. tried updating schema/tables from trello to my new notes app 5. convex doesn't show updated schema/tables that's it. that's the error.
Sara
Sara•12h ago
uh so, to explain a bit convex has two enviroments, one for dev and one for deployment AKA production, they're two seperate things, they are not the same. for running your dev enviroment, you have to keep your project updated, this is why bun is different from bunx, bunx is used to generate the _generated folder, and give you types, do you see that folder anywhere? https://docs.convex.dev/cli#run-the-convex-dev-server
CLI | Convex Developer Hub
Command-line interface for managing Convex projects and functions
Startup Spells šŸŖ„ Newsletter Guy
yes, i see it in convex/_generated it has the new schema
Sara
Sara•12h ago
React TanStack Start Start Convex Trellaux Example | TanStack Start...
An example showing how to implement Start Convex Trellaux in React using TanStack Start.
Sara
Sara•12h ago
very cool, so we don't have a problem there let me check the code for chats:create
Sara
Sara•12h ago
maybe its an internal function
Startup Spells šŸŖ„ Newsletter Guy
no i changed the schema to this this is my project (its not a notes app) but this is the updated schema
Sara
Sara•12h ago
oh uhhh have you exported the mutation?
Startup Spells šŸŖ„ Newsletter Guy
well, codex coded it lol lets see
Sara
Sara•12h ago
ok, where are you calling the function from?
Startup Spells šŸŖ„ Newsletter Guy
in prisma, we had prisma migrate same with drizzle. i guess with convex, its just convex deploy but i guess there's some mismatch in URLs in .env.local or some thing... can u tell me steps to update schema? is it just convex deploy? wait
Sara
Sara•12h ago
no, its going to be bunx convex dev deploy, you push to production, which you don't want now
Startup Spells šŸŖ„ Newsletter Guy
const createChat = useMutation(api.chats.create);
Sara
Sara•12h ago
yeah that also seems to be correct it has got to be the cli command how are you calling the createChat?
Startup Spells šŸŖ„ Newsletter Guy
Yeah like I said the error is probably in the environment file. Or something else. Because I remember last week I had another Mac This week another Mac. So probably had two different URLs for dev. Does CONVEX_DEPLOYMENT and VITE_CONVEX_URL have to be using the same URL?
Sara
Sara•12h ago
could you help me out and run the command bunx convex dev in a separate terminal?
Startup Spells šŸŖ„ Newsletter Guy
āœ” Provisioned a dev deployment and saved its name as CONVEX_DEPLOYMENT to .env.local

Write your Convex functions in convex/
Give us feedback at https://convex.dev/community or support@convex.dev
View the Convex dashboard at https://dashboard.convex.dev/d/my-url
āœ” Provisioned a dev deployment and saved its name as CONVEX_DEPLOYMENT to .env.local

Write your Convex functions in convex/
Give us feedback at https://convex.dev/community or support@convex.dev
View the Convex dashboard at https://dashboard.convex.dev/d/my-url
^^
Sara
Sara•12h ago
yippii, now what happens when you drop something to the dropzone?
Startup Spells šŸŖ„ Newsletter Guy
Could not start a new chat. Try again.
Sara
Sara•12h ago
amazing, you've got a new error
Startup Spells šŸŖ„ Newsletter Guy
This is where I got the error, the first image that I showed you. Look at the image in their original post. Not a new error, this is exactly what I was showing you at the first post
Sara
Sara•12h ago
are you logged into convex on the new device? if not try logging in
Startup Spells šŸŖ„ Newsletter Guy
Yep logged in
Sara
Sara•12h ago
I'm trying to figure this out
Sara
Sara•12h ago
I'm as confused as you are let me try on my end
Startup Spells šŸŖ„ Newsletter Guy
If you are trying then please try to change the schema into something simple like hello world app completely different than the Trello clone and see if you can deploy it
Sara
Sara•12h ago
the changes are happening on the schema, the problem is with the mutation
Startup Spells šŸŖ„ Newsletter Guy
I think the problem is not with the mutation but the table is not updating so if I see the table in convex or the schema change or the function in convex.dev's dashboard site then the mutation will work so I don't think the error is in mutation
Sara
Sara•12h ago
it is indeed the mutation, the schema is seperated from the function, and the main error you were seeing was with the mutation itself, which I assumed would be fixed if we run pnpm dlx convex dev which apearantly it didn't? so, I'd try re-writing the mutation, or calling it from the dashboard and figure out what the problem might be
Startup Spells šŸŖ„ Newsletter Guy
Okay cool, I'll try to call it from the dashboard. I think I need to drop the file somehow
Sara
Sara•12h ago
I'd try debugging on the client too, comment out things, console log things, until you figure it out and check the enviroment variables too, make sure they are correct
Startup Spells šŸŖ„ Newsletter Guy
index.tsx:45 Error: [CONVEX M(chats:create)] [Request ID: 7a275eb0caf5209c] Server Error Could not find public function for 'chats:create'. Did you forget to run npx convex dev or npx convex deploy? Called by client at async onFile (index.tsx:36:28) at async Dropzone.tsx:55:7 This is what it shows in development tools in Chrome. Maybe I'll try using plain old npm or npx rather than bun or bunx
Sara
Sara•12h ago
does your .env.local have a VITE_CONVEX_URL?
Startup Spells šŸŖ„ Newsletter Guy
yes and CONVEX_DEPLOYMENT
Sara
Sara•12h ago
are they different?
Startup Spells šŸŖ„ Newsletter Guy
see No same now, but I think they were different before, but they have been same for a long time now.
Sara
Sara•12h ago
could you go to the dashboard and check if you have the function?
Startup Spells šŸŖ„ Newsletter Guy
I think I showed you my dashboard above with both functions and all see
Sara
Sara•12h ago
oh yeah
Sara
Sara•12h ago
I don't see the functuin create is not there
Startup Spells šŸŖ„ Newsletter Guy
Yeah, that's what I told you, I don't see the table updated or the schema updated. That's why the error is not in mutation, but probably because the backend is not updating, the mutation is failing.
Sara
Sara•12h ago
so you should check your enviroment variables
Startup Spells šŸŖ„ Newsletter Guy
Should both be same, both of the environment variable or they should be different? One starts with dev colon and other one starts with https but both have the same slug.
Sara
Sara•12h ago
My bad, I thought when you showed the functions first of that it was updating
Startup Spells šŸŖ„ Newsletter Guy
# Deployment used by `npx convex dev`
CONVEX_DEPLOYMENT=dev:aaaa-possum-231 # team: lol-ita, project: err-convex-start-bun

VITE_CONVEX_URL=https://aaaa-possum-231.convex.cloud
# Deployment used by `npx convex dev`
CONVEX_DEPLOYMENT=dev:aaaa-possum-231 # team: lol-ita, project: err-convex-start-bun

VITE_CONVEX_URL=https://aaaa-possum-231.convex.cloud
Sara
Sara•12h ago
no they shouldn't it should look something like this
# Deployment used by `npx convex dev`
CONVEX_DEPLOYMENT=dev:{your dev name} # team: sara, project: scrape-those-jobs

VITE_CONVEX_URL= {your .cloud link}
# Deployment used by `npx convex dev`
CONVEX_DEPLOYMENT=dev:{your dev name} # team: sara, project: scrape-those-jobs

VITE_CONVEX_URL= {your .cloud link}
Startup Spells šŸŖ„ Newsletter Guy
Anything wrong with mine?
Sara
Sara•11h ago
no I'm out of ideas
Startup Spells šŸŖ„ Newsletter Guy
Can you point this out to a senior engineer because I saw that this is a very common error that has been happening since 2023
Sara
Sara•11h ago
I am a senior engineer
Startup Spells šŸŖ„ Newsletter Guy
. . . . Oops, sorry. Can you add an API or some CLI tool to make sure that migrations happen when someone changes a project like Prisma Migrate or Drizzle Migrate?
Sara
Sara•11h ago
check this
Startup Spells šŸŖ„ Newsletter Guy
oh yea i saw this i'm in dev env bdw npm/npx doesnt work
Sara
Sara•11h ago
I am testing out bun right now, but I generally think its either the dev enviroment variables, or that you might be updating things to a different enviroment, like a different deployment, I'd remove .env.local, and then run bunx convex dev, and chose the project. this way we can confirm its working 100% show logs?
Clever Tagline
Clever Tagline•11h ago
...but not with Convex. That was the implication that I got.
Startup Spells šŸŖ„ Newsletter Guy
cool, i did not know u can remove .env.local
Sara
Sara•11h ago
indeed I'm not, but this is a SIMPLE ISSUE WHY CAN'T IT BE SOLVEEED
Startup Spells šŸŖ„ Newsletter Guy
we got an impostor here jk jk oh so i added .env for GEMINI_API_KEY is there a way .env override? bcz that's the problem totally my fault i guess i have only 2 env in .env
Sara
Sara•11h ago
I think you should add it to the .env.local
Startup Spells šŸŖ„ Newsletter Guy
2 convex env in .env.local
Sara
Sara•11h ago
ooof
Startup Spells šŸŖ„ Newsletter Guy
naah that didnt do anything i added 4 of them on both .env & .env.local still same
Sara
Sara•11h ago
copy your .env variables somewhere, and remove the envirmont files completly, run bunx convex dev and chose your project what happens after this point?
Startup Spells šŸŖ„ Newsletter Guy
ok so i removed .env.local then it asked to create new proj i did all that but same error i evne got a new url now i dont even see any tables or functions
Sara
Sara•11h ago
but.. I asked you to run the equivlent of pnpm dlx convex dev in bun ... not to deploy...
Startup Spells šŸŖ„ Newsletter Guy
i do get failure rate tho
No description
Startup Spells šŸŖ„ Newsletter Guy
i run those 2 commands first
Sara
Sara•11h ago
don't run deploy
Startup Spells šŸŖ„ Newsletter Guy
#1 bun run dev -> convex dev deploy is ran afterward like 3rd command i shouldnt run it anytime i guess
Sara
Sara•11h ago
keep the bunx convex dev running, and do changes to your schema, does that work? don't run it at all please, that's like the last thing you want to do when you're starting out with a new project with a new tool is this the development or deployment? I'll consider this a success šŸ˜…
Startup Spells šŸŖ„ Newsletter Guy
i was already getting that the first time lol cool i'll delete the .env.local again & restart
Sara
Sara•11h ago
Perfect. this is great nah, just don't run deploy that was the problem like I explained earlier, you need to keep the cli command running to see changes on your dashboard, when you finish the whole project, you run the deploy command
Startup Spells šŸŖ„ Newsletter Guy
i didnt same error still
Sara
Sara•11h ago
and got luck on your learning journey, farewell! I'll let you debug it, My time is up at the moment
Startup Spells šŸŖ„ Newsletter Guy
well nothing reallly worked i followed ur advice this time perfectly no deploy only convex dev and schema changes nothing happened the functions/tables didnt get created on cloud's local deployment (convex.dev) dashboard how do they get created if u can answer that, it'd be helpful??
Sara
Sara•11h ago
I don't know, I really don't know šŸ˜…
Startup Spells šŸŖ„ Newsletter Guy
also, if u can pass on this msg to someone else, i'd really appreciate u i know its very simple... just my first time with convex lol really wanna use it... but if this doesnt work, i'll have to go back to sqlite again haha... wrote a massive app today with convex in 2 hours using all codex so its good but doesnt wrok for me
Sara
Sara•11h ago
You need to understand that mods are just people like you trying to help, you need to debug everything on your own, and not expect the magical reply to come withing the first 10 min of the thread being updated.. If it works for you, and Its a fresh project completly, I'd try creating a new fresh project and starting over untill it works, and I don't really know what the problem is (anymore). for all I know, we can see the function and its been updated.. see those resources: https://docs.convex.dev/quickstart/bun https://docs.convex.dev/quickstart/tanstack-start and I personally recommend starting with the method: npm create convex@latest -- -t tanstack-start
Bun Quickstart | Convex Developer Hub
Add Convex to a Bun project
TanStack Start Quickstart | Convex Developer Hub
Add Convex to a TanStack Start project
Sara
Sara•11h ago
I really have a to go now, I recommend writing a new ticket
Startup Spells šŸŖ„ Newsletter Guy
Well, I did debug. I debugged & gave the details in the first message itself which we both came to at the end of 175 messages. U got to the same conclusion as me. So I'm not really sure what I can do more. I followed all ur steps too. I was just hoping if u would pass my message to someone who wrote the Convex code as they might know the answer. I tried every avenue before coming here: AI, StackOverflow & all kinds of searches but nothing really worked. Bdw, I followed the guide only. I am not sure what else I can provide tbh. Anyways, thanks Sara for u trying this for so long with me. But if u can pass my msg to someone, I'd appreciate it. Thanks again.
Sara
Sara•11h ago
ran a quick sandbox to see if its bun, turns out it is not https://codesandbox.io/p/devbox/eloquent-chebyshev-2q932j
Startup Spells šŸŖ„ Newsletter Guy
Thanks Sara, did you figure out the issue then? Is it with this specific project? Like the clone I did with Trellaux
Sara
Sara•9h ago
No i don't think so - It was probably a developer error on your end, while running the commands Like is said, if it's fresh and you don't care about the project , start fresh, and if you face another problem make a new thread, we'll be happy to help šŸ™‚ Also asking #ai helps sometimes
Startup Spells šŸŖ„ Newsletter Guy
Yeah I did on the site itself. Will try to think what the error could be lol. Thanks so much for trying.

Did you find this page helpful?