RJ
RJā€¢2y ago

File naming conventions in `convex` directory

Am I correct in believing that files in the convex directory must be camel-cased? If so, it would be nice if they didn't have to be.
9 Replies
ballingt
ballingtā€¢2y ago
they shouldn't have to be! What are you seeing here, eg an issue with dashes?
RJ
RJOPā€¢2y ago
Hmm, yeah I was (or thought I was), but if you don't think they need to be let me look into it a bit more to verify that that's the problem (or that there is a problem)! Does this look familiar at all?
Error: Unable to push deployment config to https://ideal-skunk-624.convex.cloud
āœ– Waiting for all table indexes to be backfilled...
400 Bad Request: InvalidModulePath: mutations/internal/insert-inventory-update.js is not a valid path to a Convex function
Error: Unable to push deployment config to https://ideal-skunk-624.convex.cloud
āœ– Waiting for all table indexes to be backfilled...
400 Bad Request: InvalidModulePath: mutations/internal/insert-inventory-update.js is not a valid path to a Convex function
ballingt
ballingtā€¢2y ago
thank you for checking! Yes that looks familiar, I fixed the client-side version of this but the server-side part @RJ did this path autocomplete? I'd expect it to instead be mutations/internal/insert_inventory_update We want these to be valid JavaScript identifiers because we it gives us more options for future API changes, like say const data = mutations.insert_inventory_update.useQuery()
RJ
RJOPā€¢2y ago
insert-inventory-update did autocomplete! And the file is kebab-cased, not snake-cased. I tried insert_inventory_update instead with useMutation and it wasn't recognized. FWIW, I care more about the filename casing than the function (or string argument to useX function) casing. Also I could imagine that being configurable in convex.json? So I guess my takeaway here is that I can't actually use kebab-casing for Convex functions at the moment? Does that sound correct? I see this is happening for a file in my Convex directory that just contains a single type, as well:
400 Bad Request: InvalidModulePath: nested-inventory-update.js is not a valid path to a Convex function
400 Bad Request: InvalidModulePath: nested-inventory-update.js is not a valid path to a Convex function
I guess that's not surprising, given what you explained to me earlier today about how Convex bundling works.
ballingt
ballingtā€¢2y ago
FWIW, I care more about the filename casing than the function (or string argument to useX function) casing. Also I could imagine that being configurable in convex.json?
Could you say more, "care more" as in you'd like to be allowed to use kebab case but don't mind if we modify it in the strings? That's the intended behavior, sounds like we have a bug here.
So I guess my takeaway here is that I can't actually use kebab-casing for Convex functions at the moment? Does that sound correct?
That sounds right, we need to fix this.
RJ
RJOPā€¢2y ago
Right yes, that's exactly what I mean! I guess I meant "I care more about having the power to determine the filename casing vs the function etc. casing" Ok, gotcha! I've just reverted the changes I had made to kebab-case my convex dir and everything is working fine again, so I'm not blocked (just slightly aesthetically saddened) Thanks again for your help!
ballingt
ballingtā€¢2y ago
we've got you, @lee likes dashes in filenames too
jamwt
jamwtā€¢2y ago
dashes are good
RJ
RJOPā€¢10mo ago
This would still be nice to have! šŸ‘€ I tested this again recently and see that Convex filenames still can't be kebab-cased, but FWIW I'd still ā¤ļø it if they were! The error message is nice and descriptive now, though.

Did you find this page helpful?