Starting Angular app exceeds 512MB and crashes - heroku

I tried to deploy an Angular app inside Docker but failed to start it :
2021-12-19T13:12:05.766168+00:00 app[angular.1]: Compiling #angular/material/paginator : es2015 as esm2015
2021-12-19T13:12:07.703222+00:00 app[angular.1]: Compiling #angular/material/chips : es2015 as esm2015
2021-12-19T13:12:07.726244+00:00 app[angular.1]: Compiling #angular/material/badge : es2015 as esm2015
2021-12-19T13:12:08.747145+00:00 app[angular.1]: Compiling #angular/material/table : es2015 as esm2015
2021-12-19T13:12:08.799065+00:00 heroku[angular.1]: Process running mem=778M(151.5%)
2021-12-19T13:12:08.831354+00:00 heroku[angular.1]: Error R14 (Memory quota exceeded)
2021-12-19T13:12:09.614878+00:00 app[angular.1]: Compiling #angular/material/divider : es2015 as esm2015
2021-12-19T13:12:10.652232+00:00 app[angular.1]: Compiling #angular/material/snack-bar : es2015 as esm2015
2021-12-19T13:12:11.723629+00:00 app[angular.1]: Compiling #angular/material/autocomplete : es2015 as esm2015
2021-12-19T13:12:11.731124+00:00 app[angular.1]: Compiling #angular/material/checkbox : es2015 as esm2015
2021-12-19T13:12:58.300999+00:00 heroku[angular.1]: Process running mem=750M(146.5%)
2021-12-19T13:12:58.304598+00:00 heroku[angular.1]: Error R14 (Memory quota exceeded)
2021-12-19T13:13:21.814944+00:00 heroku[angular.1]: Process running mem=951M(185.8%)
2021-12-19T13:13:21.820760+00:00 heroku[angular.1]: Error R14 (Memory quota exceeded)
2021-12-19T13:13:39.269766+00:00 heroku[angular.1]: Process running mem=1279M(250.0%)
2021-12-19T13:13:39.360959+00:00 heroku[angular.1]: Error R15 (Memory quota vastly exceeded)
2021-12-19T13:13:39.369783+00:00 heroku[angular.1]: Stopping process with SIGKILL
2021-12-19T13:13:39.754136+00:00 heroku[angular.1]: Process exited with status 137
2021-12-19T13:13:39.838667+00:00 heroku[angular.1]: State changed from up to crashed
Is there a solution other than ugrading to a $250/month (2.5 GB) plan?
UPDATE : my Dockerfile
FROM node:14.15.0-alpine3.12
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . ./
EXPOSE 4200
CMD ["npm", "start"]
UPDATE 2: Here's my package.json
I use nodemon because I couldn't manage to make Angular rebuild the app hosted in Docker when modifications occur.
...
"scripts": {
"ng": "ng",
"start": "nodemon --exec \"ng serve --host 0.0.0.0 --poll 1\"",
"build": "ng build",
...

Related

Error when trying to containerize a Docker image

I am working on a project and cant get past this error and google hasnt helped me much. Would someone be able to help me understand what to fix here?
The full repo you can find here: https://github.com/apatel544/good-eat-delivery-app
Ive tried deploying this to heroku and there was an error when I try pushing the heroku container up to the master heroku app. The above code snippets were what many posts said was the solution but now its giving my the error I pasted above.
My Dockerfile:
`
FROM node:14
#create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
#installing dependencies
COPY package*.json /usr/src/app/
RUN npm install
#copying source files
COPY . /usr/src/app
#building app
RUN npm run build
#running the app
CMD "npm" "run" "start"
`
My Package.json (running node version 14.0.0 because the project is a bit dated)
{
"name": "restaurant-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p $PORT"
},
"dependencies": {
"#apollo/client": "^3.2.4",
"#stripe/react-stripe-js": "^1.1.2",
"#stripe/stripe-js": "^1.10.0",
"axios": "^0.19.2",
"firebase": "^9.12.1",
"graphql": "^15.3.0",
"isomorphic-fetch": "^2.2.1",
"js-cookie": "^2.2.1",
"next": "^9.5.5",
"react": "16.14.0",
"react-dom": "16.14.0",
"reactstrap": "^8.6.0"
},
"description": "Exercise05 is full Shopping Cart with Stripe Billing",
"main": "index.js",
"author": "jrw#mit.edu",
"license": "MIT"
}
Error Message:
restaurant-app#0.1.0 start /usr/src/app
next start -p $PORT
(node:20) UnhandledPromiseRejectionWarning: Error: Option requires argument: -p (alias for --port)
at arg (/usr/src/app/node_modules/next/dist/compiled/arg/index.js:1:2174)
at nextStart (/usr/src/app/node_modules/next/dist/cli/next-start.js:4:84)
at /usr/src/app/node_modules/next/dist/bin/next:26:341
(Use node --trace-warnings ... to show where the warning was created)
(node:20) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:20) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

monitoring esxi using prometheus : getting error undefined: debug.ReadBuildInfo

i am trying monitor esxi via prometheus to grafana using https://github.com/devinotelecom/prometheus-vmware-exporter
when i am running
[root#admin01 prometheus-vmware-exporter]# docker build -t prometheus-vmware-exporter .
Sending build context to Docker daemon 157.7kB
Step 1/9 : FROM golang:1.11 as builder
---> 43a154fee764
Step 2/9 : WORKDIR /src/github.com/devinotelecom/prometheus-vmware-exporter
---> Using cache
---> 6b2aad4c7a43
Step 3/9 : COPY ./ /src/github.com/devinotelecom/prometheus-vmware-exporter
---> Using cache
---> 2f5f1b155f7f
Step 4/9 : RUN go get -d -v
---> Using cache
---> a48d35b3d5e2
Step 5/9 : RUN CGO_ENABLED=0 GOOS=linux go build
---> Running in 86199cee4fcb
# github.com/prometheus/client_golang/prometheus
/go/src/github.com/prometheus/client_golang/prometheus/build_info_collector.go:24:15: undefined: debug.ReadBuildInfo
The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux go build' returned a non-zero code: 2
[root#admin01 prometheus-vmware-exporter]#
Thanks for your help in Advanced
The minimal golang version in prometheus is 1.15, but in the Dockerfile it says 1.11
source : https://github.com/prometheus/client_golang/blob/main/go.mod
Try changing golang:1.11 to golang:1.15++ in Dockerfile

Concurrently path failure

Question Description
I'm trying to simultaneously run multiple commands using the Concurrently package.
My package.json:
{
"name": "emojifier",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start-dev": "concurrently -c \"yellow.bold,green.bold\" -n \"SERVER,BUILD\" \"./node_modules/.bin/ts-node-dev server/index.ts\" \"ng build --watch\" \"ng serve\""
}
}
This script works fine on Ubuntu and Mac. However, when running it via CMD or Powershell, I get the error:
[SERVER] '.' is not recognized as an internal or external command,
[SERVER] operable program or batch file.
[SERVER] ./node_modules/.bin/ts-node-dev server/index.ts exited with code 1
Why is this happening and what is a proper work-around? Is this a bug with Concurrently?
Debugging Attempts
When I switch the forward-slashes to back-slashes:
concurrently -c "yellow.bold,green.bold" -n "SERVER,BUILD" ".\node_modules\.bin\ts-node-dev.cmd .\server\index.ts" "ng build --watch" "ng serve"
The error is resolved.
If I remove the ./ prefix from the path name, the error changes to:
[SERVER] 'node_modules' is not recognized as an internal or external command,
[SERVER] operable program or batch file.
[SERVER] node_modules/.bin/ts-node-dev server/index.ts exited with code 1

NativeScript UI Autocomplete don't compiled

In my nativescript app, I have a problem about using nativescript ui autocomplete. I compile my mobile application to android apps. It has an error as below
<======-------> 50% CONFIGURING [3s]
<====---------> 35% EXECUTING [13s]
<======-------> 51% EXECUTING [20s]
Exception in thread "main" java.lang.ClassNotFoundException: Class: com.telerik.widget.autocomplete.ShowSuggestionListListener
at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:776)
at org.nativescript.staticbindinggenerator.Generator.collectInterfaceMethods(Generator.java:703)
at org.nativescript.staticbindinggenerator.Generator.getPublicApi(Generator.java:227)und 0 errors. Watching for file changes.
at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:342)
at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:133)
at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:172)
at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:90)
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:66)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:47)
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:runSbg'.
Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 25s
10:34:24 - Found 0 errors. Watching for file changes.
Unable to apply changes on device: 192.168.80.101:5555. Error is: Command ./gradlew failed with exit code 1.
Executing after-watch hook from /home/andre/nativescript/TigaRoda/hooks/after-watch/nativescript-dev-typescript.js
Stopping tsc watch
Executing after-watch hook from /home/andre/nativescript/TigaRoda/hooks/after-watch/nativescript-dev-webpack.js
Stopping webpack watch
delete node_modules, platforms, hooks folders and package-lock.json file
run
npm i
rebuild the project ->
tns run android
or
tns build android

yarn permission problems on OSX high sierra

I'm really scratching my head on this one, and have spent around 1.5 days on trying to resolve the problem
the problem I think has to do with permissions that somehow got reset -
I suspect it happened after I got boot camp assistant to partition for windows dual boot
Environment:
Writing selenium test cases in typescript, using Alsatian and Zalenium frameworks over ts-node - the following command being used to initialise the test runner
yarn run ts-node Tests/runner.ts --tap
yarn environment is running through brew
package.json:
{
"dependencies": {
"#types/dotenv": "^4.0.2",
"#types/selenium-webdriver": "^3.0.8",
"alsatian": "^2.2.1",
"axios": "^0.17.1",
"dotenv": "^5.0.0",
"moment": "^2.20.1",
"selenium-webdriver": "^4.0.0-alpha.1",
"tap-spec": "^4.1.1",
"ts-node": "^4.1.0",
"tslib": "1.8.1",
"typescript": "^2.6.2"
}
}
runner.ts:
import tapSpec = require('tap-spec');
import { TestSet, TestRunner } from "alsatian";
import { config as dotenv } from 'dotenv';
(async () =>
{
// Load up any pseudo environment variables
dotenv({ path: __dirname + '/../.env' });
// Setup the alsatian test runner
let testRunner = new TestRunner();
let tapStream = testRunner.outputStream;
let testSet = TestSet.create();
testSet.addTestsFromFiles('/**/*/*.spec.ts');
// This will output a human readable report to the console.
tapStream.pipe(tapSpec()).pipe(process.stdout);
// Runs the tests
await testRunner.run(testSet);
})()
.catch(e =>
{
console.error(e);
process.exit(1);
});
Problem:
I suspect the problems started after I installed dual boot windows using bootcamp assistant
I worked in windows for 3-4 days on another project and when I came back, started getting permission problems
initially they were along the lines of { Error: EACCES: permission denied, scandir '/Library/Application Support/xxxx'
which I resolved using chmod as stated below - now I'm stuck - read points 7 and 8, I don't know whats causing the problem - but I suspect it's yarn permissions
I had - also updated to typescript 2.7.1 earlier because I'm using the option "strictPropertyInitialization": false, in tsconfig - initially I thought that had cause some problem, but reverting to 2.6.2 hasn't resolved it
removed and rebuilt node_modules
ran first aid from disk utility on partition
reset permissions : https://support.apple.com/en-us/HT203538
re-installed yarn
re-installed brew
granted each complained folder sudo chmod -R 777 '/Library/Application Support', now complaining about no access to '/System/Library/User Template' , cannot use chmod here because I get the error, operation not allowed
yarn run ts-node Tests/runner.ts --tap gives:
warning package.json: No license field
$ /Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/.bin/ts-node Tests/runner.ts --tap
{ Error: EACCES: permission denied, scandir '/System/Library/User Template'
at Object.fs.readdirSync (fs.js:924:18)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:288:41)
at GlobSync._readdirInGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:267:20)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:276:17)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:137:22)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)0
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:207:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:380:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:130:10)
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/System/Library/User Template' }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
sudo yarn run ts-node Tests/runner.ts --tap gives:
{ Error: EBADF: bad file descriptor, scandir '/dev/fd/13'
at Object.fs.readdirSync (fs.js:924:18)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:288:41)
at GlobSync._readdirInGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:267:20)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:276:17)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:137:22)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:207:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:380:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:130:10)
errno: -9,
code: 'EBADF',
syscall: 'scandir',
path: '/dev/fd/13' }
error Command failed with exit code 1.
UPDATE 1 - 19 FEB 2017:
I've placed a test.ts file - which does nothing but print to console , if I call that from yarn ts-node, that works fine
yarn run ts-node Tests/test.ts
output:
yarn run v1.3.2
warning package.json: No license field
$ /Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/.bin/ts-node Tests/test.ts
this is a test
✨ Done in 0.61s.
test.ts:
(async () =>
{
console.log("this is a test");
})()
.catch(e =>
{
console.error(e);
process.exit(1);
});
I have also attempted, what the comment has suggested by #ILI - I fixed the permissions using First Aid in disk utility on the mac partition , since brew no longer supports sudo, I uninstalled yarn from brew, and added it to global packages using
sudo yarn install yarn -g
but still have the same EACCESS error - Error: EACCES: permission denied, scandir '/Library/Application Support/OpenVPN/profile'
Also tried running yarn --verbose, didn't get much detail from there
yarn run --verbose ts-node Tests/runner.ts --tap
yarn run v1.3.2
warning package.json: No license field
verbose 0.331 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.npmrc".
verbose 0.331 Checking for configuration file "/Users/dshamim/.npmrc".
verbose 0.331 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/Acurus/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/Projects/.npmrc".
verbose 0.332 Checking for configuration file "/Users/dshamim/.npmrc".
verbose 0.333 Checking for configuration file "/Users/.npmrc".
verbose 0.333 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.yarnrc".
verbose 0.333 Checking for configuration file "/Users/dshamim/.yarnrc".
verbose 0.334 Found configuration file "/Users/dshamim/.yarnrc".
verbose 0.334 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.334 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/.yarnrc".
verbose 0.334 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/anex/.yarnrc".
verbose 0.334 Checking for configuration file "/Users/dshamim/Projects/Acurus/ANEX/.yarnrc".
verbose 0.335 Checking for configuration file "/Users/dshamim/Projects/Acurus/.yarnrc".
verbose 0.337 Checking for configuration file "/Users/dshamim/Projects/.yarnrc".
verbose 0.338 Checking for configuration file "/Users/dshamim/.yarnrc".
verbose 0.338 Found configuration file "/Users/dshamim/.yarnrc".
verbose 0.338 Checking for configuration file "/Users/.yarnrc".
verbose 0.34 current time: 2018-02-19T00:39:49.960Z
$ /Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/.bin/ts-node Tests/runner.ts --tap
{ Error: EACCES: permission denied, scandir '/Library/Application Support/OpenVPN/profile'
at Object.fs.readdirSync (fs.js:924:18)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:288:41)
at GlobSync._readdirInGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:267:20)
at GlobSync._readdir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:276:17)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:137:22)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processReaddir (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:207:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:132:10)
at GlobSync._processGlobStar (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:380:10)
at GlobSync._process (/Users/dshamim/Projects/Acurus/ANEX/anex/ANEX.Website.ManagementPortal.Tests/node_modules/glob/sync.js:130:10)
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/Library/Application Support/OpenVPN/profile' }
verbose 51.049 Error: Command failed with exit code 1.
at /usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js:35620:15
at Generator.throw (<anonymous>)
at step (/usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js:92:30)
at /usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js:105:13
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Some times it's the simple things that we miss, don't worry we have all been here.
This is a case of over thinking the issue, to steal a line from an Aussie beer commercial, you need to "UNDERTHINK IT". https://youtu.be/1MdAhVetBq8
The fact that your simple test script worked but the main test runner didn't, would have pointed me in the direction of stepping through the test runner script, rather than looking at yarn or any other culprit.
Turns out you were telling alsatian to search your entire hard drive for test cases, in which some folders it did not have permissions to access.
Change:
testSet.addTestsFromFiles('/**/*/*.spec.ts');
To:
testSet.addTestsFromFiles('**/*/*.spec.ts');
Or:
testSet.addTestsFromFiles('./**/*/*.spec.ts');
And all should work as you expect.

Resources