3

On my Heroku app, I deploy multiple times a day. With every release, the Heroku "slug" keeps getting bigger even with minor code changes. This is the kind of message I see in the build log:

Warning: Your slug size (446 MB) exceeds our soft limit (300 MB) which may affect boot time.

The prior build was 444 MB, the one before 441, etc.

With every release it gets bigger, until it reaches Heroku's hard limit of 500 MB and then I need to clear the build cache manually.

Why is the build cache getting bigger for minor code changes? How can I prevent it from reaching the hard limit of 500 MB, which breaks my automated deployments?

conradkleinespel
  • 6,560
  • 10
  • 51
  • 87

1 Answers1

4

Have you tried downloading the slugs for two builds and comparing the contents? You could use the slugs CLI plugin to download them and see what extra files are clogging things up: https://github.com/heroku/heroku-slugs

jvergeldedios
  • 637
  • 1
  • 6
  • 15
  • Hadn't thought of that. Will do! – conradkleinespel Dec 17 '19 at 16:59
  • 1
    That helps! I am now able to see that between two builds, the `node_modules directory` is getting 25Mb larger even though we're not changing anything in `package-lock.json`. More precisely, it's `node_modules/.cache` that is getting bigger. – conradkleinespel Jan 31 '20 at 15:46
  • 4
    The issue was due to us using `cache: true` with the Webpack Terser Plugin. Heroku then cached Terser's cache. With each release, things got bigger. With `cache: false`, things are back to normal. Given that the issue may be something else for another project, the idea of downloading the slugs to figure things out still seems like *the* thing to do, so I'll leave that as the accepted answer. Thanks @jvergeldedios! – conradkleinespel Jan 31 '20 at 16:48