Disk space issues?

I just noticed a warning re: disk space on my Discord bot project. It is boosted so I get 400 MB. As far as I can tell the majority of the space is taken up by node_modules (about 248 MB) but that is suspicious in a couple of ways.

On my PC that folder is 138 MB so seemingly something additional is getting loaded. Also the docs seem to indicate that node-related files are part of a separate disk space allocation, i.e. it should be in addition to the 400 MB for the app.

Any ideas?

image

While we’re discussing it what is with the “run git prune; git gc” recommendation. A quick check of the internet suggests that running git gc automatically runs git prune. In any case I ran it and it didn’t make a significant difference.

Thanks.

1 Like

By way of comparison, another bot I wrote (though much simpler) reports 3 MB / 400 MB being used. And the /app/node_modules folder for that one reports 0 MB (using du).

I’m unfamiliar with bots and any differences between building them vs. say, React apps or regular static sites. But…did you try removing the node_modules and doing a fresh install? Or maybe just npm prune. I’ve had weird stuff happen where packages get malformed somehow and clearing/reinstalling, plus a good refresh always works.

I managed to reduce it to 301 MB by commenting the devDependencies which didn’t need to be there. It looks like the other libraries are all being used.

From the FAQ it appears that the folder shouldn’t be counting at all.

Container Space

  • By default your node.js modules don’t count towards that total - there’s a separate 1GB limit for node modules.*

Glad you were able to remove what you don’t need! I have noticed that my node_modules are always at zero when I go in the terminal to check my files. I don’t have anything boosted but shouldn’t matter.

Hi Christina. Well I reduced it a tiny bit but the warning was still present. Perhaps I can get someone from Glitch to confirm the rules and to see if something is set incorrectly causing my node_modules space to count towards my limit.

Meanwhile I pulled the code from GitHub into a new project and it reports 246 MB / 400 MB and it is back in the green. This project has to be boosted because it exceeds the un-boosted limit and my old project just went belly up when I un-boosted that one. I’m not certain that I can access it anymore as disk error message just appeared.

Nope it is hosed. Suspending projects is turning out to be a critically bad solution.

That’s annoying. I know you said you commented out the devDependencies but did you also prune them from node_modules? I also get rid of the package-lock.json when I clear things out.

Otherwise, it looks like someone from Glitch will have to dig. Good luck :slightly_smiling_face:

Yes I sent an email to support. The latest 246 MB report includes the devDependencies again as I didn’t comment them out this time.

I tried running npm prune earlier on and it only gave me some errors. When I comment the section and refresh it builds anew and those libraries (Jest in this case) would not be loaded in.

Commented it again and I am down to 218 MB. Significantly better than it was.

1 Like

I fixed the devDependencies issue the way it is supposed to be used. I set my NODE_ENV setting to prod but it needed to be production. Now npm ignores the dev-related dependencies. Still at 218 MB but no extra work to attain that.

Hi @tleylan

I’m sorry that your project was suspended for disk space immediately after you unBoosted it. We agree that this can be frustrating and our team is planning some editor improvements including better warning notifications so that folks aren’t caught off guard.

In the meantime, if you ever have a project Boosted or not that gets suspended or stops responding due to disk space, you can send us a support request (which you have done, thanks!) and we will un-suspend it for you.

To answer you question about overall disk space vs. node module space:
Node modules are counted towards a separate limit. However, we recently discovered a bug that causes the Node Modules to be counted towards the 200/400MB disk space limits when a project is using Node 16. Our team is working to fix this. Once it has been resolved, I will post an update here.

Hi Tasha,

Appreciate the update and I’m sure you will find a solution but may I suggest a system whereby the project is “suspended from running” but not necessarily suspended from accessing?

There should be a way for the customer to fix the problem if they have inadvertently caused it without a lot of fanfare.

Thanks,

Tom

2 Likes

I think that is great feedback Tom. I will definitely share it with the team here at Glitch.

1 Like

Hello,

We have fixed the issue that was causing node modules to incorrectly count toward the project disk space limit when using Node 16.

In order for the fix to be applied to a pre-existing Node 16 project, you will need to do the following:

  1. Open the project in the editor
  2. Click Tools and then Terminal to open the project console.
  3. In the terminal, run the following commands:
    rm -rf node_modules
    enable-npm

Once you do this, any node modules that are used by the project will count towards the separate limit for node module space.

If you have any questions, let me know!

3 Likes

Well let me be the first to report “it works”. My usage went from 214 MB previously to 9 MB now.

Thanks.

2 Likes