Adding and then removing a watch.json file breaks auto install/refresh

I added a watch.json file to try and optimize when my Node.js/express app refreshes and how hard (install vs restart). It wasn’t working as expected, so I removed the watch.json file entirely. Now the project never refreshes at all unless I open a terminal and run refresh manually :cry:.

I have a project with the following watch.json file:

{
  "install": {
    "include": [
      "^package\\.json$",
      "^\\.env$"
    ]
  },
  "restart": {
    "exclude": [ ],
    "include": [
      "server\\.js",
      "assets\\.js",
      "\\.json"
    ]
  },
  "throttle": 100
}

This project does not restart when I change server.js

Either I’m totally misunderstanding the watch.json file, or it would seem that there is a >50% chance that any given edit to it will just put your app into a bad state and you just have to wait for it to get forcibly rebooting :triumph:. And of course I can’t find a shred of official documentation for this thing.

Can anybody out there give me a clue?!

One reason I’ve been so confused is that watch.json does not affect auto-refresh in the preview panel/window (what you get by clicking the “show” button). So some things that I thought were not working (such as excludes), actually were working, I was just assessing them incorrectly (seeing if the preview panel refreshed as opposed to if the spinner showed up next to app status).

However, I still have the issue of putting my app in the bad state when editing watch.json. And I haven’t been able to get https://api.glitch.com/projects/{my-project-name}/stop?authorization={my-persistent-token} to work which I have seen referenced in other forum posts.

What are you having trouble with? What error message does the API give?

I get a 404 Not Found response, here’s an example using curl:

curl --location --request POST 'https://api.glitch.com/projects/code-haumana-p5js-hot-reload/stop?authorization={redacted-uuid}'

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.