watcher behavior
It appears that when running
convex dev
, the file watcher does not step into shared helpers that are imported. I had an action that was importing a util. Was confused when making changes to this dep by adding logging, I was not seeing those logs in the convex admin. Not until I touched the action file that imported the dep did the function push occur.17 Replies
Adding @sujayakar, our resident file watcher expert
Havent test exhaustively, but seems limited to actions. Initial observation is that query/mutation functions appear to push when deps change.
hey @allen, yeah that's interesting that it works for queries/mutations but not actions. will take a look!
@allen, which operating system and version are you on?
osx and 0.10.0
oh sorry, which version of osx? 🙂
13.0.1
one sanity check before digging in further: do file update notifications work in other apps (e.g. your editor)? if you open activity monitor, do you see anything suspicious with
fseventsd
(e.g. it taking up 100% CPU)?I dont see fseventsd running at all. File watching and hot reloading seems to work elsewhere fine.
oh right, I think macOS hides it from activity monitor. can you check
top
from a command line?
(but if notifications are working elsewhere it's likely fseventsd
is working just fine.)cpu seems to be between 0.0-0.2% for fseventsd
I set up a small repro locally, and editing an action's dependencies in
node_modules/
seems to work for me.
if you run npx convex dev --verbose --trace-events
, it'll print out whenever it sees an event as well as whenever it watches a file. can you try that and see if the files you're expecting are making it into the list?
and if you have a smaller reproduction you'd be comfortable sharing, I'd be happy to try it to dig in more.I see this logged out when starting with the verbose flag, however, this is the file thats not triggering updates:
Processing add utils/stripe.ts
huh, very interesting.
hmm it seems to be working now. My guess is restarting
convex dev
sorted it outinteresting. yeah, honestly having worked with filesystem notifications across a bunch of OSes at a previous job, the implementation in macOS is just kind of flaky sometimes. (hence asking if
fseventsd
, macOS's userspace process that manages file system events, was in a bad state.) I usually just reboot my system if I run into file system notification issues.
another diagnostic for next time would be to have npx convex dev --verbose --trace-events
running in one terminal and sudo fs_usage -f pathname | grep <path you're editing>
in another one. then, edit the file and see what fs_usage
spits out.
(fs_usage
is a pretty cool tool independently! you can get a stream of all network, filesystem, and process activity on the system printed to stdout.)alright thanks. I'll keep an eye out for it.
happy to dig in more if it pops up again, let me know!