question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory quota exceeded when deploying to Heroku

See original GitHub issue

Building on local machine works fine, and takes about 10 seconds, but fails once deployed to Heroku. 2 out of 10 times it success building production build on Heroku, i don’t know why.

2018-10-15T19:32:06.251040+00:00 heroku[web.1]: Starting process with command `npm run build && node app.js`
2018-10-15T19:32:09.573768+00:00 app[web.1]: 
2018-10-15T19:32:09.573787+00:00 app[web.1]: > react-app@0.1.0 build /app
2018-10-15T19:32:09.573789+00:00 app[web.1]: > react-scripts build
2018-10-15T19:32:09.573791+00:00 app[web.1]: 
2018-10-15T19:32:14.133886+00:00 app[web.1]: Creating an optimized production build...
2018-10-15T19:32:41.548599+00:00 heroku[web.1]: Process running mem=600M(117.4%)
2018-10-15T19:32:41.548726+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2018-10-15T19:33:06.390664+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-10-15T19:33:06.390664+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-10-15T19:33:06.541622+00:00 heroku[web.1]: Process exited with status 137
2018-10-15T19:33:06.561336+00:00 heroku[web.1]: State changed from starting to crashed
2018-10-15T19:33:06.563135+00:00 heroku[web.1]: State changed from crashed to starting
2018-10-15T19:33:24.413153+00:00 heroku[web.1]: Starting process with command `npm run build && node app.js`

My app.js example

const express = require('express');
const http = require('http');
const path = require('path');
let app = express();

app.use(express.static(path.join(__dirname, 'build')));
const port = process.env.PORT || '3000';
app.set('port', port);
const server = http.createServer(app);
server.listen(port, '0.0.0.0', () => console.log(`Running on localhost:${port}`));

Procfile

web: npm run build && node app.js

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Timercommented, Oct 24, 2018

But yes, the proper solution is building in postinstall. Better yet, use the heroku-postbuild so this only happens in Heroku.

2reactions
Keksikecommented, Oct 23, 2018

Workaround for me is to add "postinstall": "react-scripts build" to package.json in scripts, but question is still open

If I have understood correctly, this isn’t a workaround, but rather the correct way of doing it. The building should be done on postinstall or heroku-postbuild rather than start.

Read more comments on GitHub >

github_iconTop Results From Across the Web

R14 - Memory Quota Exceeded in Ruby (MRI)
If you're getting R14 - Memory quota exceeded errors, it means your application is using swap memory. Swap uses the disk to store...
Read more >
Heroku Error R14 (Memory quota exceeded): How do I solve ...
Look for code with 'Model.all.each do |something|' and replace with Model.find_each do |something| . This will save memory by loading chunks of your...
Read more >
Fighting the Heroku `Error R14 (Memory quota exceeded ...
I was trying to fight the Error R14 (Memory quota exceeded) for my play-scala application running on Heroku. It involves analyzing the issue ......
Read more >
Heroku – Memory quota vastly exceeded - Julia Discourse
Hey there, I developed a Julia application using Dash and ObjectDetector, and deployed on Heroku. But I am having “R15 - Memory quota...
Read more >
The Heroku memory quota exceeded on the free tier ... - Quora
Either: * Pay your hosting service for more memory (I would recommend profiling your code first under load conditions to see what memory...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found