allen
allen•2y ago

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
jamwt
jamwt•2y ago
Adding @sujayakar, our resident file watcher expert
allen
allenOP•2y ago
Havent test exhaustively, but seems limited to actions. Initial observation is that query/mutation functions appear to push when deps change.
sujayakar
sujayakar•2y ago
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?
allen
allenOP•2y ago
osx and 0.10.0
sujayakar
sujayakar•2y ago
oh sorry, which version of osx? 🙂
allen
allenOP•2y ago
13.0.1
sujayakar
sujayakar•2y ago
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)?
allen
allenOP•2y ago
I dont see fseventsd running at all. File watching and hot reloading seems to work elsewhere fine.
sujayakar
sujayakar•2y ago
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.)
allen
allenOP•2y ago
cpu seems to be between 0.0-0.2% for fseventsd
sujayakar
sujayakar•2y ago
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.
allen
allenOP•2y ago
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
sujayakar
sujayakar•2y ago
huh, very interesting.
allen
allenOP•2y ago
hmm it seems to be working now. My guess is restarting convex dev sorted it out
sujayakar
sujayakar•2y ago
interesting. 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.)
allen
allenOP•2y ago
alright thanks. I'll keep an eye out for it.
sujayakar
sujayakar•2y ago
happy to dig in more if it pops up again, let me know!

Did you find this page helpful?