Project ran out of disk space?


#1

hi there,

so my project at some point in the past few days stopped working. i just now looked at the project and it seemed to have ran out of disk space? it seems like my node_modules directory was getting accounted for but my understanding is that it is not supposed to count towards the disk limit? i deleted my node_modules directory and re-ran pnpm i and my project started working again.

so my question is: is there any way to figure out how long this has not been working (and perhaps what caused the problem); and two, is there anything i can do to prevent this from crashing again in the future?

thank you!


#2

Hey @edwardsharp! Welcome to the Glitch forums.

What do you mean by it stopping working? A couple things I’ll highlight from the help pages:

  • Projects sleep after 5 minutes if they are not used, and those running for more than 12 hours are stopped. They wake again when they receive another HTTP request.
  • Projects have a limit of 200MB of disk space on the container. Though things written to ‘/tmp’ don’t count towards that, nor do your Node.js modules. Plus, there’s an additional 512MB of assets storage space too.

Were you getting warnings or errors telling you that the disk space was full?


#3

hi, thanks for the follow up && sure sure, thanks for reminding me about the time/size limits. looking more at the logs it looks like my app could not start because a npm module could not be found react-scripts

emergency-index-submission-2018@0.0.1 dev:start /app
react-scripts start

sh: 1: react-scripts: not found

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! emergency-index-submission-2018@0.0.1 dev:start: react-scripts start
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the emergency-index-submission-2018@0.0.1 dev:start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npm-cache/10.15.0/_logs/2019-01-26T03_17_14_696Z-debug.log

i mention the disk space thing because i saw a warning in the container stats about disk usage and using the console noticed the filesystem was, indeed, full. are there more logs a glitch admin might be able to see to help understand why this happened? and if there’s anything i can do to avoid such? i’m not sure why the npm module stopped being there unless for some reason the container/project was re-built? i’m not sure why the contents of node_modules/ would change, otherwise?

also, by stop working i mean: the project would not load because the start script failed because of the missing npm module, so page didn’t load and eventually gave a 500 error.


#4

Thanks, that’s a helpful clarification! I think you’re right that the error was caused by the missing node module.

I’m still learning about how Glitch works, but I found another comment here on the forums that might hold the answer:

Based on that, I think that when your project comes back online after it’s been stopped, it’s treated as if it’s a fresh install in a container - npm install happens before whatever’s in your start script.

As for why the react-scripts package wasn’t found… I’m still thinking on that.


#5

okay, thanks for thinking/talking about this :slight_smile:

the node_modules folder + my project files would exceed the 200mb file system quota so it feels like there was a …glitch in the quota accounting for the node_modules folder?

…but perhaps even more strange is that react-scripts is really just a devDependency in my project. and the start script should only use react-scripts when it needs to build or run in dev environment. so yeah, confused here.


#6

Okay @edwardsharp! It’s amazing what sleep (and a little help from coworkers) can accomplish. Here’s what I think happened.

node_modules is excluded from your disk space count as long as you’re using pnpm. If somehow you had initially installed your node_modules with regular npm, that could have filled up your disk space.

Since the npm install couldn’t finish, if-env wasn’t available to make the check of environment in your start script. So, it was treated like an undefined variable (I think) and that’s why your program ended up in the dev:start section instead of the one intended for prod.


#7

curious, okay, this makes sense. thanks very much for the info!