Deploy Meteor App To AMAZON EC2 using MUP Error - node.js

I'm trying to use METEOR UP MUP to deploy my Meteor App to AWS AMAZON EC2.
I use different NPM Modules as well as METEOR PACKAGES in my Meteor App. It all works perfectly on my computer.
When I do a mup deploy I get the following errors:
[52.89.165.48] - Uploading bundle
[52.89.165.48] - Uploading bundle: SUCCESS
[52.89.165.48] - Setting up Environment Variables
[52.89.165.48] - Setting up Environment Variables: SUCCESS
[52.89.165.48] - Invoking deployment process
[52.89.165.48] x Invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
sseph.h:4:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4251)
^
In file included from ../src/house.cc:1:0:
../src/swisseph.h:4:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4251)
^
In file included from ../src/eclipse.cc:1:0:
../src/swisseph.h:4:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning (disable : 4251)
^
gyp info ok
npm WARN package.json meteor-dev-bundle#0.0.0 No description
npm WARN package.json meteor-dev-bundle#0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle#0.0.0 No README data
stop: Unknown instance:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
App did not pick up! Please check app logs.
-----------------------------------STDOUT-----------------------------------
> node ./build.js
`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
ansi-regex#0.2.1 node_modules/ansi-regex
ansi-styles#1.1.0 node_modules/ansi-styles
escape-string-regexp#1.0.3 node_modules/escape-string-regexp
chalk#0.5.1 node_modules/chalk
strip-ansi#0.3.0 node_modules/strip-ansi
supports-color#0.2.0 node_modules/supports-color
has-ansi#0.1.0 node_modules/has-ansi
eachline#2.3.3 node_modules/eachline
type-of#2.0.1 node_modules/type-of
amdefine#1.0.0 node_modules/amdefine
asap#2.0.3 node_modules/asap
meteor-promise#0.4.8 node_modules/meteor-promise
underscore#1.5.2 node_modules/underscore
promise#7.0.4 node_modules/promise
source-map-support#0.3.2 node_modules/source-map-support
semver#4.1.0 node_modules/semver
source-map#0.1.32 node_modules/source-map
fibers#1.0.5 node_modules/fibers
Waiting for MongoDB to initialize. (5 minutes)
connected
AppName start/running, process 12612
Waiting for 15 seconds while app is booting up
Checking is app booted or not?
----------------------------------------------------------------------------
What's causing this?
How do I solve this?
Thank you....it's my first time using AWS EC2...

Make sure your mup.json nodeVersion is up to date with the Node version (0.10.40) required by the latest Meteor version (1.2).
"nodeVersion": "0.10.40",

Related

Dev Script Doesn't Work In Remix With Cloud Flare Pages

I made a app with create-remix and I chose to use Cloud Flare Pages. Made the app but when I run npm run dev I get a error. I am on the latest node version (v17.3.1). I get this error the first time I run the dev script:
Watching Remix app in development mode...
Compiling worker to "/tmp/functionsWorker.js"...
✘ [ERROR] Could not resolve "../build"
functions/[[path]].js:4:23:
4 │ import * as build from "../build";
╵ ~~~~~~~~~~
1 error(s) and 0 warning(s) when compiling Worker.
Build failed with 1 error:
functions/[[path]].js:4:23: ERROR: Could not resolve "../build"
ERROR: "dev:wrangler" exited with 1.
Then if I run it again I get this error (probably because it builds the build folder the first time I run it before I get the error):
Watching Remix app in development mode...
Compiling worker to "/tmp/functionsWorker.js"...
✘ [ERROR] Could not resolve "../build"
functions/[[path]].js:4:23:
4 │ import * as build from "../build";
╵ ~~~~~~~~~~
1 error(s) and 0 warning(s) when compiling Worker.
Build failed with 1 error:
functions/[[path]].js:4:23: ERROR: Could not resolve "../build"
ERROR: "dev:wrangler" exited with 1.
Idk why I get this error as it is the default template. Thanks in advance.
I found out on the remix discord server that you need to downgrade versions to fix this. To do that just run npm install wrangler#beta

App engine deployment down with "The Node.js binary could not be verified"

My app engine deployment (flexible environment, node js 12) has suddenly started failing, seemingly due to an issue with node js on the google side.
Build output here:
Step #1: Already have image (with digest): gcr.io/kaniko-project/executor#sha256:f87c11770a4d3ed33436508d206c584812cd656e6ed08eda1cff5c1ee44f5870
Step #1: [36mINFO[0m[0000] Removing ignored files from build context: [node_modules .dockerignore Dockerfile npm-debug.log yarn-error.log .git .hg .svn app.yaml]
Step #1: [36mINFO[0m[0004] Downloading base image gcr.io/google-appengine/nodejs#sha256:ef8be7b4dc77c3e71fbc85ca88186b13214af8f83b8baecc65e8ed85bb904ad5
Step #1: [36mINFO[0m[0019] Taking snapshot of full filesystem...
Step #1: [36mINFO[0m[0035] Using files from context: [/workspace]
Step #1: [36mINFO[0m[0036] COPY . /app/
Step #1: [36mINFO[0m[0036] Taking snapshot of files...
Step #1: [36mINFO[0m[0037] RUN /usr/local/bin/install_node '>=12.0.0'
Step #1: [36mINFO[0m[0037] cmd: /bin/sh
Step #1: [36mINFO[0m[0037] args: [-c /usr/local/bin/install_node '>=12.0.0']
Step #1: % Total % Received % Xferd Average Speed Time Time Time Current
Step #1: Dload Upload Total Spent Left Speed
100 32.1M 100 32.1M 0 0 66.9M 0 --:--:-- --:--:-- --:--:-- 66.8M
Step #1: % Total % Received % Xferd Average Speed Time Time Time Current
Step #1: Dload Upload Total Spent Left Speed
100 3838 100 3838 0 0 23116 0 --:--:-- --:--:-- --:--:-- 23260
Step #1: gpg: Signature made Tue Sep 8 15:43:07 2020 UTC using RSA key ID C17AB93C gpg: Can't check signature: public key not found
Step #1: The Node.js binary could not be verified.
Step #1: This means it may not be an officially released Node.js binary
Step #1: or may have been tampered with.
Step #1:
Step #1: Aborting the installation.
Step #1:
Step #1: The installation can be forced using the --ignore-verification-failure
Step #1: flag. However, it is strongly recommended that you install a version
Step #1: of Node.js that can be verified.
Step #1:
Step #1: Node installation failed: /opt/gcp/runtime/bootstrap_node exited with a non-zero exit code: 1
Step #1: error building image: error building stage: waiting for process to exit: exit status 1
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/kaniko-project/executor#sha256:f87c11770a4d3ed33436508d206c584812cd656e6ed08eda1cff5c1ee44f5870" failed: step exited with non-zero status: 1
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Is anybody else seeing this issue?
Thanks
Chris
In our case, the thing was that App Engine installed Node 14.10.0 because we had "node": "14.x" in the package.json. Seems like the latest release has some issues.
I fixed deploy by changing the engine to a fixed version:
"engines": {
"node": "14.9"
}
If you are using 12.x - try some of the previous version that worked.
The latest that works is 14.16.0. Add the following in your package.json
...
"engines": {
"node": "14.16.0"
},
...
Then deploy with gcloud app deploy. The GCP issue to follow is https://github.com/GoogleCloudPlatform/nodejs-docker/issues/214
This happens quite often whenever a new Nodejs version is released as GAE builder "is not entirely backwards compatible between minor version upgrades" (Source: https://github.com/GoogleCloudPlatform/nodejs-docker/issues/214#issuecomment-1276728834)
The fix/solution would be to pin down the last version that worked (in most cases, the 2nd most recent that was released: https://nodejs.org/en/download/releases/). You will most likely notice that a nodejs version was released around the time your build started failing.

502 Bad Gateway when hosting a Meteor app on AWS Elastic Beanstalk with Meteor-up

I have a Meteor app I've been trying to deploy to AWS with mup-aws-beanstalk.
Here is my repository This is a basic "Hello world" equivalent of MongoDB, Meteor, React, Node.js app. How to install
This works perfectly fine localy, and runs on http://localhost:3000/. When I try to deploy to AWS with the meteor-up mup-aws-beanstalk plugin, it deploys, but I get a 502 Bad Gateway error.
I'm pretty new to this but I did some research and checked the logs.
Checking the logs, I see that the start script isnt working properly
> mup-meteor-example-deploy-aws#1.0.0 start /var/app/current
> bash ./start.sh
┌──────────────────────────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /tmp/.config │
└──────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /tmp/.config │
└──────────────────────────────────────────────────┘
Node version
v12.16.1
Npm version
6.14.0
=> Starting health check server
=> Starting App
/var/app/current/programs/server/node_modules/fibers/fibers.js:90
return fn.apply(this, arguments);
^
Error: $ROOT_URL, if specified, must be an URL
at packages/meteor.js:1328:13
at packages/meteor.js:1343:4
at packages/meteor.js:1508:3
at /var/app/current/programs/server/boot.js:401:38
at Array.forEach (<anonymous>)
at /var/app/current/programs/server/boot.js:226:21
at /var/app/current/programs/server/boot.js:464:7
at Function.run (/var/app/current/programs/server/profile.js:280:14)
at /var/app/current/programs/server/boot.js:463:13
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mup-meteor-example-deploy-aws#1.0.0 start: `bash ./start.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mup-meteor-example-deploy-aws#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
I checked the above problem and other StackOverflow questions mention to make the URL start with http or https, which my does.
Then there is also an error from nginx, there are these lines that keep repeating. I am not sure if these two are related.
This post describes the problem might be because the app isn't running on the server/port combination
HOWEVER, this post states that it might be because Elastic Beanstalk is reading the wrong file first, and therefore not opening up the ports in the first place?
I am not sure how or where to change the port numbers, or if this is a problem with npm.
-------------------------------------
/var/log/nginx/error.log
-------------------------------------
2020/07/13 04:02:02 [error] 4632#0: *148508 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.21.16, server: , request: "GET /aws-health-check-3984729847289743128904723 HTTP/1.1", upstream: "http://127.0.0.1:8039/aws-health-check-3984729847289743128904723", host: "172.31.46.135"
2020/07/13 04:02:06 [error] 4632#0: *148510 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.46.174, server: , request: "GET /aws-health-check-3984729847289743128904723 HTTP/1.1", upstream: "http://127.0.0.1:8039/aws-health-check-3984729847289743128904723", host: "172.31.46.135"
2020/07/13 04:02:17 [error] 4632#0: *148512 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.21.16, server: , request: "GET /aws-health-check-3984729847289743128904723 HTTP/1.1", upstream: "http://127.0.0.1:8039/aws-health-check-3984729847289743128904723", host: "172.31.46.135"
This is my deployment output
PS G:\GitFolder\meteor-example-deploy-aws\.deploy> mup deploy
=> Setting up
=> Ensuring IAM Roles and Instance Profiles are setup
Building App Bundle Locally
WARNING: The output directory is under your source tree.
Your generated files may get interpreted as source code!
Consider building into a different directory instead
meteor build ../output
app/node_modules/semantic-ui-css/semantic.css: warn: There are some #import rules in the middle of a file. This might be a bug, as imports are only valid at the beginning of a file.
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
Unable to resolve some modules:
"#babel/runtime/helpers/createSuper" in /G/GitFolder/meteor-example-deploy-aws/app/imports/ui/layouts/App.jsx (web.browser.legacy)
If you notice problems related to these missing modules, consider running:
meteor npm install --save #babel/runtime
=> Archiving Bundle
10% Archived
20% Archived
30% Archived
40% Archived
50% Archived
60% Archived
70% Archived
80% Archived
90% Archived
100% Archived
=> Uploading bundle
Uploaded 11%
Uploaded 23%
Uploaded 35%
Uploaded 46%
Uploaded 58%
Uploaded 70%
Uploaded 81%
Uploaded 93%
Uploaded 100%
Finishing upload. This could take a couple minutes
=> Creating Version
=> Configuring Beanstalk Environment
Updated Environment
=> Waiting for Beanstalk Environment to finish updating
Env Event: Updating environment mup-env-meteor-example-deploy-aws's configuration settings.
Env Event: Rolling with Additional Batch deployment policy enabled. Launching a new batch of 1 additional instance(s).
Env Event: Batch 1: 1 EC2 instance(s) [i-0b017a1b7f1c7151a] launched. Deploying application version.
Env Event: Environment health has transitioned from Severe to Degraded. 100.0 % of the requests are failing with HTTP 5xx. ELB processes are not healthy on 1 out of 2 instances. Configuration update in progress on 1 instance. 0 out of 2 instances completed (running for 2 minutes). ELB health is failing or not available for 1 out of 2 instances. Impaired services on 1 out of 2 instances.
Env Event: Added instance [i-0b017a1b7f1c7151a] to your environment.
Env Event: Failed to run npm install. Snapshot logs for more details.
Env Event: Retrieving logs prior to instance(s) termination. Logs will be available for an hour in the environment management console and at elasticbeanstalk-us-east-1-966889535256/resources/environments/logs/bundle/e-kvnxyajrem.
Env Event: During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.
Env Event: Failed to deploy configuration.
Env Event: Terminating excess instance(s): [i-0b017a1b7f1c7151a].
Env Event: Command execution completed on all instances successfully.
Env Event: [Instance: i-0b017a1b7f1c7151a] Successfully finished bundling 16 log(s)
=> Deploying new version
=> Waiting for Beanstalk Environment to finish updating
Env Event: Environment health has transitioned from Degraded to Severe. 100.0 % of the requests are failing with HTTP 5xx. Command failed on 1 out of 2 instances. Incorrect application version found on 1 out of 2 instances. Expected version "5" (deployment 10). ELB processes are not healthy on all instances. Application update in progress (running for 42 seconds). ELB health is failing or not available for all instances. Impaired services on 1 out of 2 instances.
Env Event: Rolling with Additional Batch deployment policy enabled. Launching a new batch of 1 additional instance(s).
Env Event: Removed instance [i-0b017a1b7f1c7151a] from your environment.
Env Event: Added instance [i-0733205831e115a28] to your environment.
Env Event: Batch 1: 1 EC2 instance(s) [i-0733205831e115a28] launched. Deploying application version '5'.
Env Event: Unsuccessful command execution on instance id(s) 'i-0733205831e115a28'. Aborting the operation.
Env Event: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
Env Event: [Instance: i-0733205831e115a28] Command failed on instance. Return code: 127 Output: (TRUNCATED)...
/opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh: line 12: nvm: command not found
/opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh: line 13: nvm: command not found
/opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh: line 14: npm: command not found.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/45node.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
Env Event: Retrieving logs prior to instance(s) termination. Logs will be available for an hour in the environment management console and at elasticbeanstalk-us-east-1-966889535256/resources/environments/logs/bundle/e-kvnxyajrem.
Env Event: Excess instance(s) terminated.
Env Event: Terminating excess instance(s): [i-0733205831e115a28].
Env Event: Command execution completed on all instances successfully.
Env Event: [Instance: i-0733205831e115a28] Successfully finished bundling 15 log(s)
Env Event: Environment health has transitioned from Severe to Degraded. 100.0 % of the requests are failing with HTTP 5xx. Command failed on 1 out of 2 instances. Incorrect application version found on 1 out of 2 instances. Expected version "1" (deployment 1). ELB processes are not healthy on 1 out of 2 instances. Application update is aborting. 1 out of 2 instances completed (running for 4 minutes). ELB health is failing or not available for 1 out of 2 instances. Impaired services on 1 out of 2 instances.
App is running at mup-env-meteor-example-deploy-aws.eba-cah6ppkm.us-east-1.elasticbeanstalk.com
=> Finding old versions
=> Removing old versions
=> Updating Beanstalk SSL Config
and this everything in my mup.js file
app: {
// Tells mup that the AWS Beanstalk plugin will manage the app
type: 'aws-beanstalk',
name: 'meteor-example-deploy-aws',
path: 'G:/GitFolder/meteor-example-deploy-aws/app',
env: {
ROOT_URL: 'http://mup-env-meteor-example-deploy-aws.eba-cah6ppkm.us-east-1.elasticbeanstalk.com/',
MONGO_URL: 'mongodb://MYUSERNAME:MYPASSREDACTED#docdb-2020-07-06-07-57-38.cluster-c9vs8fwnppko.us-east-1.docdb.amazonaws.com:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'
},
auth: {
id: 'AKIA6C...',
secret: 'xCBpL....'
},
minInstances: 1
},
plugins: ['mup-aws-beanstalk']
};

Bluemix push error

i'm getting an error when I try to push to BlueMix from local.
> node lib/install.js
> optipng-bin#3.1.4 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-optipng/node_modules/optipng-bin
✔ optipng pre-build test passed successfully
> pngquant-bin#3.1.1 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-pngquant/node_modules/pngquant-bin
> node lib/install.js
✔ pngquant pre-build test passed successfully
> gifsicle#3.0.4 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js
✔ gifsicle pre-build test passed successfully
/tmp/buildpacks/cbed2b9b0603a1febfaafeebb556dd0b/lib/dependencies.sh: line 1: 163 Killed npm install --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
-----> Build failed
Failed to compile droplet
Check our support community to get help on common issues:
http://ibm.biz/bluemixcommunitysupport
If you need additional help and your subscription includes support, submit a ticket so we can help:
http://ibm.biz/bluemixsupport
Exit status 223
Staging failed: Exited with status 223 (out of memory)
Destroying container
Successfully destroyed container
FAILED
Error restarting application: StagingError
It works great locally. I tried increasing memory to 1GB, didn't help either. Please help.

buffer.js Node error with mup deploy - how can i undo ` sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node `

I had an issue deploying a meteor app with mup and got this error:
tarted TaskList: Deploy app 'thermaMup' (linux)
[107.170.77.189] - Uploading bundle
[107.170.77.189] - Uploading bundle: SUCCESS
[107.170.77.189] - Setting up Environment Variables
[107.170.77.189] - Setting up Environment Variables: SUCCESS
[107.170.77.189] - Invoking deployment process
[107.170.77.189] x Invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
npm WARN package.json meteor-dev-bundle#0.0.0 No description
npm WARN package.json meteor-dev-bundle#0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle#0.0.0 No README data
npm WARN cannot run in wd meteor-dev-bundle#0.0.0 node npm-rebuild.js (wd=/opt/thermaMup/tmp/bundle/programs/server)
stop: Unknown instance:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 80: Connection refused
App did not pick up! Please check app logs.
My logs read
[107.170.77.189] error: Script restart attempt #150[107.170.77.189]
[107.170.77.189] Meteor requires Node v0.10.41 or later.[107.170.77.189]
And I've been able to solve this problem on my separate laptop by changing my mup.json file to have a longer deployCheckWaitTime, and a different nodeVersion. BUT, I had alreadly run these commands on my desktop:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node
And now the error I'm seeing on my desktop since is:
Building Started: .
buffer.js:106
throw new Error(
^
Error: If encoding is specified then the first argument must be a string
at new Buffer (buffer.js:106:13)
at Readable.<anonymous> (/usr/local/lib/node_modules/mup/node_modules/archiver/lib/util/index.js:32:15)
at emitNone (events.js:91:20)
at Readable.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:926:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
How do I undo those previous sudo commands? Should I just uninstall and reinstall node completely?
I have installed Node v8.10.0 made one change in the following file in my
node_modules\node_modules\archiver\lib\util\index.js
source.on('end', function() {
//(may be different for few) Line 32:
// updated this line and add +'' in the first param to make it as string argument
var buf = new Buffer(size+'', 'utf8');
var offset = 0;
collection.forEach(function(data) {
data.copy(buf, offset);
offset += data.length;
});
});
I hope this helps
I seemed to have fixed this by installing node 4.4.3 instead of 6.0.0 github.com/Azure/azure-xplat-cli/issues/2825

Resources