Memory quota exceeded when deploying to Heroku
See original GitHub issueBuilding 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:
- Created 5 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But yes, the proper solution is building in
postinstall
. Better yet, use theheroku-postbuild
so this only happens in Heroku.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
orheroku-postbuild
rather thanstart
.