It's me, Ryan!
(Thanks Tierney!)
Get them deetz:
npx ryanmurakami
🐹⚽Demo Project for AWS Developer: Designing and Developing on Pluralsight
Hello,
When using the create-ec2-instance.js script to deploy this project to an ec2 instance, the UserData script is pulling the code from master instead of main.
This causes the stylesheets and favicon to comeback as a 404.
Please update the UserData script so that it points to the main branch when uploading to ec2.
User data script is not executing properly for marketplace ami. In the cloud-init-output.log I am seeing:
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0xb09980 node::Abort() [npm ci]
2: 0xa1c235 node::FatalError(char const*, char const*) [npm ci]
3: 0xcf77be v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [npm ci]
4: 0xcf7b37 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [npm ci]
5: 0xeaf3d5 [npm ci]
6: 0xebf09d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [npm ci]
7: 0xec1d9e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [npm ci]
8: 0xe832da v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [npm ci]
9: 0x11fc026 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [npm ci]
10: 0x15f0a99 [npm ci]
/var/lib/cloud/instance/scripts/part-001: line 8: 2763 Aborted sudo npm ci
If I SSH and sudo npm ci and sudo npm run start manually, I am able to start the application, however I get some ugly output there as well:
> [email protected] prestart
> npm run build
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs'
}
npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
npm WARN logfile errno: -13,
npm WARN logfile code: 'EACCES',
npm WARN logfile syscall: 'scandir',
npm WARN logfile path: '/root/.npm/_logs'
npm WARN logfile }
⸨⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⸩ ⠋ : WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
> [email protected] build
> webpack
Browserslist: caniuse-lite is outdated. Please run:: permission denied, scandir '/root/.npm/_logs'
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
> [email protected] start
> node index.js
Server started at http://localhost:3000
I'm going through the Pluralsight AWS: Designing and Developing course and I had issues spinning this up. After a ton of debugging the UserData I discovered that webpack wasnt running because it wasnt downloading the whole project and that the bin
dir didnt exist. Apparently its a known issue. I also had to set up Node Forever in order to get it to spin things up.
I think the root issue is something to do with the package-lock.json
and webpack. My final working UserData was as follows:
#!/bin/bash
sudo apt-get update
sudo apt-get -y install git
rm -rf /home/bitnami/hbfl
git clone https://github.com/ryanmurakami/hbfl.git /home/bitnami/hbfl
chown -R bitnami: /home/bitnami/hbfl
cd /home/bitnami/hbfl
sudo rm package-lock.json >> /error.txt 2>&1
sudo npm install >> /error.txt 2>&1
sudo npm install -g forever >> /error.txt 2>&1
sudo node node_modules/webpack/bin/webpack.js >> /error.txt 2>&1
sudo forever start index.js >> /error.txt 2>&1
Also, I learned after the fact that I didnt need to manually dump to an error file because of the log file at /var/log/cloud-init-output.log
Anyhoo, great course. Just wanted to raise this flag.
[email protected] install C:\Users\Saleh\hbfl\node_modules\bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Saleh\AppData\Local\Programs\Python\Python36\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gypgyp ERR! stackERR! at ChildProcess.exithandler (child_process.js:289:12)
gyp configure error
ERR!gyp stackERR! at ChildProcess.emit (events.js:182:13)
gypstack Error: Command failed: C:\Users\Saleh\AppData\Local\Programs\Python\Python36\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
ERR!gyp stack at maybeClose (internal/child_process.js:962:16)
ERR!gyp stackERR! File "", line 1
gypstack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
ERR!gyp ERR!stack import sys; print "%s.%s.%s" % sys.version_info[:3];
Systemgyp Windows_NT 10.0.17134
gypERR! stackERR! ^
gypcommand "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding"
ERR!gyp stackERR! SyntaxError: invalid syntax
gypcwd C:\Users\Saleh\hbfl\node_modules\bcrypt
gypERR! ERR! stacknode -v
v10.13.0
gypgyp ERR!ERR! stacknode-gyp -v at ChildProcess.exithandler (child_process.js:289:12)
v3.8.0
gypgyp ERR! ERR!stack at ChildProcess.emit (events.js:182:13)
not okgyp
ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gypgyp ERR!ERR! build errorstack
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp gypERR! ERR!stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding' (1)
Systemnode-pre-gyp Windows_NT 10.0.17134
gyp ERR! ERR!stack at ChildProcess. (C:\Users\Saleh\hbfl\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
commandnode-pre-gyp "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding"
gypERR! stackERR! at ChildProcess.emit (events.js:182:13)
node-pre-gypcwd C:\Users\Saleh\hbfl\node_modules\bcrypt
gypERR! ERR!stack at maybeClose (internal/child_process.js:962:16)
node -vnode-pre-gyp v10.13.0
ERR!gyp stackERR! at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gypnode-gyp -v v3.8.0
ERR!gyp SystemERR! Windows_NT 10.0.17134
node-pre-gypnot ok
ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Saleh\hbfl\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Saleh\hbfl\node_modules\bcrypt
node-pre-gyp ERR! node -v v10.13.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Saleh\hbfl\node_modules\bcrypt\lib\binding' (1)
npm WARN [email protected] requires a peer of webpack@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Saleh\AppData\Roaming\npm-cache_logs\2018-11-05T10_58_29_684Z-debug.log
Saleh@DESKTOP-UEISOV8 MINGW64 ~/hbfl (master)
$
Hi Ryan,
I'm doing your Pluralsight AWS Developer: Designing and Developing and noticed that the Users.js and UserFavorites.js routines throw an error because both modules have this requirement that doesn't exist in the provided code (and wouldn't work anyway since the course calls for a MySQL database):
const client = require('../aurora.client')
Easily fixed by changing it to this:
const client = require('../mysql.client')
Thanks!
hbfl-main\scripts\module_02>node create-ec2-instance.js
Failed to create instance with: VPCIdNotSpecified: No default VPC for this user
at Request.extractError hbfl-main\node_modules\aws-sdk\lib\services\ec2.js:50:35)
at Request.callListeners \hbfl-main\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
)
at Request.callListeners (Downloads\hbfl-main\node_modules\aws-sdk\lib\sequential_executor.js:116:18) {
code: 'VPCIdNotSpecified',
time: 2021-09-10T20:14:32.900Z,
requestId: 'e1ecfc96-b54d-4802-8f93-3f59ad74ffb1',
statusCode: 400,
retryable: false,
retryDelay: 46.060148016048075
In the module_09 in pluralsight, it references lib/data/lib/sns.js which is not in the codebase.
When trying to install node_module dependencies getting an error:
Errorounous dependency: scp2
175 http fetch GET 200 https://registry.npmjs.org/scp2 730ms (cache revalidated)
176 timing metavuln:packument:scp2 Completed in 730ms
177 timing command:install Completed in 2918ms
178 verbose stack TypeError: Invalid Version: 0.1.0a2
178 verbose stack at new SemVer (/home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/semver/classes/semver.js:38:13)
178 verbose stack at compareBuild (/home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/semver/functions/compare-build.js:3:20)
178 verbose stack at /home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/semver/functions/sort.js:2:51
178 verbose stack at Array.sort ()
178 verbose stack at Object.sort (/home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/semver/functions/sort.js:2:36)
178 verbose stack at Advisory.[calculateRange] (/home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:169:28)
178 verbose stack at Advisory.load (/home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:157:28)
178 verbose stack at Calculator.[calculate] (/home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js:60:14)
178 verbose stack at async Promise.all (index 0)
178 verbose stack at async Map.[init] (/home/x/.nvm/versions/node/v16.15.1/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:186:9)
Assumably this is due to npm audit, thus setting a flag --no-audit, when running npm install fixes the issue.
After implementing the functionality I'm getting this error:
Failed to create auto scaling group with: Error [ValidationError]: You must use a valid fully-formed launch template. Value () for parameter groupId is invalid. The value cannot be empty
at deserializeAws_queryCreateAutoScalingGroupCommandError (/home/x/Documents/aws-developer/hbfl-main/node_modules/@aws-sdk/client-auto-scaling/dist-cjs/protocols/Aws_query.js:1237:41)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Assumably it has something to do with groupId parameter in the params.LaunchTemplate object literal inside of the createAutoScalingGroup function thus nothing is mentioned in the course video.
I will appreciate any help.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: forever stopall && ./node_modules/.bin/forever start index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\girishsuri\AppData\Roaming\npm-cache_logs\2019-05-17T06_48_50_692Z-debug.lo
'There were 2 validation errors:\n* MissingRequiredParameter: Missing required key 'GroupName' in params\n* UnexpectedParameter: Unexpected key 'Group' found in params',
C:\tony-aws-\hbfl-master\scripts\module_06>node create-route53-recordset.js
(node:9008) UnhandledPromiseRejectionWarning: TypeError: route53.createRecordSet is not a function
at C:\tony-aws-\hbfl-master\scripts\module_06\create-route53-recordset.js:47:13
Thanks
I am facing issue for creating instance by using scripts from scripts/03 folder and error is
Failed to create instance with: TypeError: input is not iterable
at serializeAws_ec2SecurityGroupStringList (D:\Learning\AWS\hbfl\node_modules@aws-sdk\client-ec2\dist\cjs\protocols\Aws_ec2.js:38389:23)
at serializeAws_ec2RunInstancesRequest (D:\Learning\AWS\hbfl\node_modules@aws-sdk\client-ec2\dist\cjs\protocols\Aws_ec2.js:37708:31)
at Object.serializeAws_ec2RunInstancesCommand (D:\Learning\AWS\hbfl\node_modules@aws-sdk\client-ec2\dist\cjs\protocols\Aws_ec2.js:5844:12)
at serialize (D:\Learning\AWS\hbfl\node_modules@aws-sdk\client-ec2\dist\cjs\commands\RunInstancesCommand.js:111:26)
at D:\Learning\AWS\hbfl\node_modules@aws-sdk\middleware-serde\dist\cjs\serializerMiddleware.js:5:27
at D:\Learning\AWS\hbfl\node_modules@aws-sdk\middleware-logger\dist\cjs\loggerMiddleware.js:6:28
at EC2Client.send (D:\Learning\AWS\hbfl\node_modules@aws-sdk\smithy-client\dist\cjs\client.js:23:20)
at sendCommand (D:\Learning\AWS\hbfl\scripts\03\create-ec2-instance.js:15:17)
at createInstance (D:\Learning\AWS\hbfl\scripts\03\create-ec2-instance.js:94:12)
at execute (
----------------------------CODE------------------------------------
// Imports
const {
EC2Client,
AuthorizeSecurityGroupIngressCommand,
CreateKeyPairCommand,
CreateSecurityGroupCommand,
RunInstancesCommand
} = require('@aws-sdk/client-ec2')
const helpers = require('./helpers')
function sendCommand (command) {
console.log('Started-------------------->');
const client = new EC2Client({region : process.env.AWS_REGION})
return client.send(command)
}
// Declare local variables
const sgName = 'hamster_sg'
const keyName = 'hamster_key'
// Do all the things together
async function execute () {
try {
await createSecurityGroup(sgName)
const keyPair = await createKeyPair(keyName)
await helpers.persistKeyPair(keyPair)
const data = await createInstance(sgName, keyName)
console.log('Created instance with:', data)
} catch (err) {
console.error('Failed to create instance with:', err)
}
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// Create functions
async function createSecurityGroup (sgName) {
const sgParams = {
Description : sgName,
GroupName : sgName
}
const createCommand = new CreateSecurityGroupCommand(sgParams)
const data = await sendCommand(createCommand);
console.log(data)
const rulesParams = {
GroupId: data.GroupId,
IpPermissions: [
{
IpProtocol : 'tcp',
FromPort : 22,
ToPort : 22,
IpRanges: [{ CiderIp : '0.0.0.0/0'}]
},
{
IpProtocol : 'tcp',
FromPort : 3000,
ToPort : 3000,
IpRanges: [{ CiderIp : '0.0.0.0/0'}]
}
]
}
const authCommand = new AuthorizeSecurityGroupIngressCommand(rulesParams)
return sendCommand(authCommand)
}
async function createKeyPair (keyName) {
const params = {
KeyName : keyName
}
const command = new CreateKeyPairCommand(params)
return sendCommand(command)
}
async function createInstance (sgName, keyName) {
const params = {
ImageId: 'ami-0cff7528ff583bf9a',
InstanceType: 't2.micro',
KeyName: keyName,
MaxCount: 1,
MinCount: 1,
SecurityGroups: {sgName},
userData: 'IyEvYmluL2Jhc2gKc3UgZWMyLXVzZXIKY3VybCAtLXNpbGVudCAtLWxvY2F0aW9uIGh0dHBzOi8vcnBtLm5vZGVzb3VyY2UuY29tL3NldHVwXzE2LnggfCBzdWRvIGJhc2ggLQpzdWRvIHl1bSBpbnN0YWxsIC15IG5vZGVqcwpzdWRvIHl1bSBpbnN0YWxsIC15IGdpdAplY2hvICJucG0gaW5zdGFsbCB5YXJuIC1nIgpzdWRvIG5wbSBpbnN0YWxsIHlhcm4gLWcKZWNobyAiZW5kIG5wbSBpbnN0YWxsIHlhcm4gLWciCmNkIH4KZ2l0IGNsb25lIGh0dHBzOi8vZ2l0aHViLmNvbS9yeWFubXVyYWthbWkvaGJmbC5naXQKY2QgaGJmbAplY2hvICJ5YXJuIgp5YXJuCmVjaG8gImVuZCB5YXJuIgp5YXJuIHN0YXJ0'
}
const command = new RunInstancesCommand(params)
return sendCommand(command)
}
execute ()
On ubuntu 18.04, node 10.16.3. Changing the lib from bcrypt to bcryptjs in package.json seems to fix this.
Logs follow:
tom@tom-desktop:~/Documents/hbfl(master)
▶ sudo npm install
[sudo] password for tom:
[email protected] install /home/tom/Documents/hbfl/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v64-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/tom/Documents/hbfl/node_modules/bcrypt/build'
gyp ERR! System Linux 5.0.0-27-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /home/tom/Documents/hbfl/node_modules/bcrypt
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding' (1)
node-pre-gyp ERR! stack at ChildProcess. (/home/tom/Documents/hbfl/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 5.0.0-27-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/tom/Documents/hbfl/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/tom/Documents/hbfl/node_modules/bcrypt
node-pre-gyp ERR! node -v v10.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding' (1)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/tom/Documents/hbfl/node_modules/bcrypt/build'
gyp ERR! System Linux 5.0.0-27-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/tom/Documents/hbfl/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /home/tom/Documents/hbfl/node_modules/bcrypt
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of webpack@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tom/.npm/_logs/2019-09-25T14_07_33_589Z-debug.log
On ubuntu 18.04, node 10.16.3,
npm install of
Hi Ryan, I am running into this error when running this command:
node create-ec2-instance.js
this is at creating an ec2 instance video.
Failed to create instance with: ReferenceError: KeyName is not defined at createKeyPair (/Users/noahchan/aws_learn/hbfl/scripts/module_02/create-ec2-instance.js:74:18) at createSecurityGroup.then (/Users/noahchan/aws_learn/hbfl/scripts/module_02/create-ec2-instance.js:15:16) at <anonymous> at process._tickDomainCallback (internal/process/next_tick.js:228:7)
I checked through my code and there is a
const keyName = 'hamster_key'
what else is it asking for?
As mentioned in the Discus conversation:
On build from AWS t2.micro
instance, the error below occurs, related to webpack and source-map
-> CssMinimizerPlugin
.
The same code will execute locally without a problem, but is a show stopper when deployed.
Updating to the latest version seems to fix the single cpu issue.
// file:package.json
// from
"css-minimizer-webpack-plugin": "1.1.5",
// to
"css-minimizer-webpack-plugin": "1.2.0",
A similar error was reproduced and reported here:
webpack-contrib/css-minimizer-webpack-plugin#51
https://github.com/webpack-contrib/css-minimizer-webpack-plugin/releases/tag/v1.2.0
[ 96.538557] cloud-init[3228]: (node:3407) UnhandledPromiseRejectionWarning: Error: "version" is a required argument.
[ 96.550866] cloud-init[3228]: at Object.getArg (/hbfl/node_modules/webpack/node_modules/source-map/lib/util.js:24:11)
[ 96.568571] cloud-init[3228]: at new BasicSourceMapConsumer (/hbfl/node_modules/webpack/node_modules/source-map/lib/source-map-consumer.js:294:22)
[ 96.588599] cloud-init[3228]: at new SourceMapConsumer (/hbfl/node_modules/webpack/node_modules/source-map/lib/source-map-consumer.js:22:7)
[ 96.604706] cloud-init[3228]: at SourceMapSource.node (/hbfl/node_modules/webpack/node_modules/webpack-sources/lib/SourceMapSource.js:193:4)
[ 96.611777] cloud-init[3228]: at exports.getSourceAndMap (/hbfl/node_modules/webpack/node_modules/webpack-sources/lib/helpers.js:20:27)
[ 96.624458] cloud-init[3228]: at SourceMapSource.sourceAndMap (/hbfl/node_modules/webpack/node_modules/webpack-sources/lib/SourceMapSource.js:184:10)
[ 96.640602] cloud-init[3228]: at getTaskForFile (/hbfl/node_modules/webpack/lib/SourceMapDevToolPlugin.js:78:30)
[ 96.651391] cloud-init[3228]: at /hbfl/node_modules/webpack/lib/SourceMapDevToolPlugin.js:266:22
[ 96.669602] cloud-init[3228]: at /hbfl/node_modules/webpack/lib/Cache.js:93:5
[ 96.675707] cloud-init[3228]: at Hook.eval [as callAsync] (eval at create (/hbfl/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
[ 96.684609] cloud-init[3228]: (node:3407) 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)
Hi,
I follow your lessson in Pluralsight about cloudformation for CI/CD, but i could not find the sample here eg. hbfl-pipeline.template.yaml
Could you please attach it here?
Thanks,
Xuan ([email protected])
Hi Mr, Ryan,
When i run your template hbfl-pipeline.template, i encounter the error as shown:
The following resource(s) failed to create: [HbflPipelineServiceRolePolicy, HbflPipelineArtifactStore]. . Rollback requested by user
Could you advise how to fix it?
Thanks,
Xuan
Using node 8.3.0: > node create-ec2-instance.js
Failed to create instance with: { NetworkingError: The header content contains invalid characters at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:348:11) at new ClientRequest (_http_client.js:85:14) at Object.exports.request (http.js:31:10) at Object.exports.request (https.js:199:15) at handleRequest (C:\cygwin64\home\jblayney\Projects\hbfl\node_modules\aws-sdk\lib\http\node.js:42:23) at executeSend (C:\cygwin64\home\jblayney\Projects\hbfl\node_modules\aws-sdk\lib\event_listeners.js:304:29) at Request.SEND (C:\cygwin64\home\jblayney\Projects\hbfl\node_modules\aws-sdk\lib\event_listeners.js:319:9) at Request.callListeners (C:\cygwin64\home\jblayney\Projects\hbfl\node_modules\aws-sdk\lib\sequential_executor.js:101:18) at Request.emit (C:\cygwin64\home\jblayney\Projects\hbfl\node_modules\aws-sdk\lib\sequential_executor.js:77:10) at Request.emit (C:\cygwin64\home\jblayney\Projects\hbfl\node_modules\aws-sdk\lib\request.js:683:14) message: 'The header content contains invalid characters', code: 'NetworkingError', region: 'us-east-1', hostname: 'ec2.us-east-1.amazonaws.com', retryable: true, time: 2019-02-26T20:34:23.458Z }
Following the pluralsight tutorial, here is the code:
// Imports
const AWS = require('aws-sdk')
const helpers = require('./helpers')
AWS.config.update({ region: 'us-east-1' })
// Declare local variables
const ec2 = new AWS.EC2()
const sgName = 'hamster_sg'
const keyName = 'hamster_key'
// Do all the things together
createSecurityGroup(sgName)
.then(() => {
return createKeyPair(keyName)
})
.then(helpers.persistKeyPair)
.then(() => {
return createInstance(sgName, keyName)
})
.then((data) => {
console.log('Created instance with:', data)
})
.catch((err) => {
console.error('Failed to create instance with:', err)
})
// Create functions
function createSecurityGroup (sgName) {
const params = {
Description: sgName,
GroupName: sgName
}
return new Promise((resolve, reject) => {
ec2.createSecurityGroup(params, (err, data) => {
if (err) reject(err)
else {
const params = {
GroupId: data.GroupId,
IpPermissions: [
{
IpProtocol: 'tcp',
FromPort: 22,
ToPort: 22,
IpRanges: [
{
CidrIp: '0.0.0.0/0'
}
]
},
{
IpProtocol: 'tcp',
FromPort: 3000,
ToPort: 3000,
IpRanges: [
{
CidrIp: '0.0.0.0/0'
}
]
}
]
}
ec2.authorizeSecurityGroupIngress(params, (err) => {
if (err) reject(err)
else resolve()
})
}
})
})
}
function createKeyPair (keyName) {
const params = {
KeyName: keyName
}
return new Promise((resolve, reject) => {
ec2.createKeyPair(params, (err, data) => {
if (err) reject(err)
else resolve(data)
})
})
}
function createInstance (sgName, keyName) {
const params = {
ImageId: 'ami-04bfee437f38a691e',
InstanceType: 't2.micro',
KeyName: keyName,
MaxCount: 1,
MinCount: 1,
SecurityGroups: [
sgName
],
UserData: 'IyEvYmluL2Jhc2gKY3VybCAtLXNpbGVudCAtLWxvY2F0aW9uIGh0dHBzOi8vcnBtLm5vZGVzb3VyY2UuY29tL3NldHVwXzgueCB8IHN1ZG8gYmFzaCAtCnN1ZG8geXVtIGluc3RhbGwgLXkgbm9kZWpzCnN1ZG8geXVtIGluc3RhbGwgLXkgZ2l0CmdpdCBjbG9uZSBodHRwczovL2dpdGh1Yi5jb20vcnlhbm11cmFrYW1pL2hiZmwuZ2l0CmNkIGhiZmwKbnBtIGkKbnBtIHJ1biBzdGFydAoK'
}
return new Promise((resolve, reject) => {
ec2.runInstances(params, (err, data) => {
if (err) reject(err)
else resolve(data)
})
})
}
C:\AWSDev\Code\scripts\module_02>node create-ec2-instance.js
Failed to create instance with: { Error: ENOENT: no such file or directory, open 'C:\Users\xxxxx.ssh\hamster_key2'
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\Users\xxxxx\.ssh\hamster_key2' }
I'm not using an Apple device. I'm using a Windows 10 machine.
In order for this to work correctly, I needed to comment out line 17.
//.then(helpers.persistKeyPair)
What is this doing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.