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 runI 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 mynpx convex dev
ornpx convex deploy
?
CONVEX_DEPLOYMENT
& VITE_CONVEX_URL
are 2 different URLs.
107 Replies
well, are you running
bunx convex dev
?Yes
yep, run with "x" to update the api and such
I run
bun run dev
but I also ran dev:web
& dev:convex
in 2 different terminalsI don't have much experience with bun myself, but try it with bunx
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 schemasee my functions are of the trellaux (trello clone) here

even tho i changed my schema completely
that's a pretty broad statement

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?
cool
also are you new to convex?
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.
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
yes, i see it in
convex/_generated
it has the new schemasecond, I ran the sandbox, it doesn't seem to cause a problem
https://tanstack.com/start/latest/docs/framework/react/examples/start-convex-trellaux?panel=sandbox
React TanStack Start Start Convex Trellaux Example | TanStack Start...
An example showing how to implement Start Convex Trellaux in React using TanStack Start.
very cool, so we don't have a problem there
let me check the code for chats:create

maybe its an internal function
no i changed the schema to this
this is my project (its not a notes app) but this is the updated schema
oh
uhhh
have you exported the mutation?
well, codex coded it lol
lets see

yes it did
ok, where are you calling the function from?
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
?
waitno, its going to be
bunx convex dev
deploy, you push to production, which you don't want now
const createChat = useMutation(api.chats.create);
yeah that also seems to be correct
it has got to be the cli command
how are you calling the createChat?
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?
could you help me out and run the command
bunx convex dev
in a separate terminal?
^^
yippii, now what happens when you drop something to the dropzone?
Could not start a new chat. Try again.
amazing, you've got a new error
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
are you logged into convex on the new device? if not try logging in
Yep logged in
I'm trying to figure this out
sorry
I'm as confused as you are
let me try on my end
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
the changes are happening on the schema, the problem is with the mutation
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
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 beOkay cool, I'll try to call it from the dashboard.
I think I need to drop the file somehow
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
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 bunxdoes your .env.local have a
VITE_CONVEX_URL
?yes
and CONVEX_DEPLOYMENT
are they different?
see
No same now, but I think they were different before, but they have been same for a long time now.
could you go to the dashboard and check if you have the function?
I think I showed you my dashboard above with both functions and all
see
oh
yeah
this
I don't see the functuin
create is not there
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.
so you should check your enviroment variables
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.
My bad, I thought when you showed the functions first of that it was updating
no they shouldn't
it should look something like this
Anything wrong with mine?
no
I'm out of ideas
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
I am a senior engineer
. . . . 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?
check this
oh yea i saw this
i'm in dev env
bdw npm/npx doesnt work
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?
...but not with Convex. That was the implication that I got.
cool, i did not know u can remove .env.local
indeed I'm not, but this is a SIMPLE ISSUE
WHY CAN'T IT BE SOLVEEED
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
I think you should add it to the .env.local
2 convex env in .env.local
ooof
naah that didnt do anything
i added 4 of them on both .env & .env.local
still same
copy your .env variables somewhere, and remove the envirmont files completly,
run bunx convex dev
and chose your project
what happens after this point?
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

but.. I asked you to run the equivlent of
pnpm dlx convex dev
in bun ...
not to deploy...i do get failure rate tho

i run those 2 commands first
don't run deploy
#1 bun run dev -> convex dev
deploy is ran afterward
like 3rd command
i shouldnt run it anytime i guess
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 š
i was already getting that the first time lol
cool i'll delete the .env.local again & restart
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
i didnt
same error still
and got luck on your learning journey, farewell!
I'll let you debug it, My time is up at the moment
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??
I don't know, I really don't know š
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
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
I really have a to go now, I recommend writing a new ticket
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.
ran a quick sandbox to see if its bun, turns out it is not
https://codesandbox.io/p/devbox/eloquent-chebyshev-2q932j
Thanks Sara, did you figure out the issue then? Is it with this specific project? Like the clone I did with Trellaux
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
Yeah I did on the site itself. Will try to think what the error could be lol. Thanks so much for trying.