Awakening causes request timeouts due to NPM reinstall

When my app has been asleep and a web request wakes it, it appears that NPM packages are reinstalled. In turn, then, the installer for the better-sqlite3 package rebuilds sqlite3 via gyp whether it needs it or not. Because that rebuild takes a while:

node v8.9.4, with pnpm
Installing...
A store server is running. All store manipulations are delegated to it.
Already up-to-date
Packages: +89
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> cwd: /rbd/pnpm-volume/de140b15-6961-4165-a750-fccbe3965b72/node_modules/.registry.npmjs.org/better-sqlite3/4.1.0/node_modules/better-sqlite3
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> /rbd/pnpm-volume/de140b15-6961-4165-a750-fccbe3965b72/node_modules/.registry.npmjs.org/lzz-gyp/0.4.2/node_modules/lzz-gyp/lzz-compiled/linux -hx hpp -sx cpp -k BETTER_SQLITE3 -d -hl -sl -e ./src/better_sqlite3.lzz
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> cwd: /rbd/pnpm-volume/de140b15-6961-4165-a750-fccbe3965b72/node_modules/.registry.npmjs.org/better-sqlite3/4.1.0/node_modules/better-sqlite3
Running install for registry.npmjs.org/better-sqlite3/4.1.0: ==> node-gyp rebuild
...
Running install for registry.npmjs.org/integer/1.0.3! gyp info ok 
Running install for registry.npmjs.org/integer/1.0.3, done

dependencies:
+ @slack/client 3.16.0
+ better-sqlite3 4.1.0

Total install time: 100947ms

…the web request times out. Is there a way to prevent NPM reinstallation on startup? Or, is there some way to make gyp not actually recompile sqlite3 if it’s already present?

That shouldn’t happen - it should only reinstall on changes to package.json, unless you’ve changed the behavior with a watch.json file or your start command tells it to somehow. What’s the name of your project so we can take a look at what’s up?

The project is sjv-database-bot. Thanks!

Ah, so this results from us having to disable a cache while we’re working on some things. It will be fixed up soon.

1 Like

@Gareth is there any update on this? I am having a similar issue (I don’t know if it’s because of NPM install, but I do know that it takes forever to load).

Even after sending the request a 2nd and 3rd time (with 1 second waiting between them) the project still times out.

It seems like it takes forever to wake up. When I open the IDE on my browser it takes 7 seconds to load. Is there no way to speed this up?

Hi there, Gareth does not work at Glitch anymore. You should contact Glitch Support team at support@glitch.com or get a token from glitch.happyfox.com. I contacted them about this last month and they said, “Sometimes when projects restart and they are on a host that doesn’t have the packages it needs, it will have to do a re-install. The team is currently looking into have to minimize this.”

3 Likes