sakazuki / aws-serverless-node-red Goto Github PK
View Code? Open in Web Editor NEWNode-RED on AWS Lambda using Amazon API Gateway and S3
License: Apache License 2.0
Node-RED on AWS Lambda using Amazon API Gateway and S3
License: Apache License 2.0
Where can I find the part of the code to change this?
trying this on windows...
node node_modules/.bin/node-red -s ./settings.js
results in error...
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
after running npm run setup command, i get the following
Failed to create/update the stack. Run the following command
to fetch the list of events leading up to the failure
aws cloudformation describe-stack-events --stack-name Node-RED-Togs
shows
"ResourceStatusReason": "Errors found during import:\n\tUnable to put integration on 'ANY' for resource at path '/': Invalid function ARN or invalid uri\n\tUnable to put integration on 'ANY' for resource at path '/{proxy+}': Invalid function ARN or invalid uri (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: de930542-c574-4a35-a64d-dc1ebceb0eca; Proxy: null)",
With respect to node-red deployment on AWS lambda using amazon API gateway and S3. I have created flows and deployed them. Once after deploying the flows, flows gets updated to S3 buckets and I'm able to access the HTTP request through API Gateway
I had referred GitHub - sakazuki/aws-serverless-node-red: Node-RED on AWS Lambda using Amazon API Gateway and S3 1
But main concern is:
How flows getting updated in the S3 bucket[flow.json file] (what's the process behind it) once we deploy flows locally?
How you are customizing/configuring in order to save the flows in an S3 bucket
Can you please help me out with this?
Please find screenshots for reference below
Hello,
If I use node-red-node-mysql to connect to a database the lambda returns the data as expected but the lambda stays running until the maximum execution time expires or the connection drops. This could be quite expensive as I need quite a large lambda to get the required performance. Have you got any tips?
manually edited the 4 files to put the bucked, account etc.. into them
C:\Users\mikeh\Documents\aws-serverless-node-red>npm run win-setup
[email protected] win-setup C:\Users\mikeh\Documents\aws-serverless-node-red
npm install && (aws s3api get-bucket-location --bucket %npm_package_config_s3BucketName% --region %npm_package_config_region% || npm run win-create-bucket) && npm run win-package-deploy
npm WARN [email protected] No repository field.
audited 1605 packages in 1.759s
found 7 vulnerabilities (2 low, 5 high)
run npm audit fix
to fix them, or npm audit
for details
{
"LocationConstraint": null
}
[email protected] win-package-deploy C:\Users\mikeh\Documents\aws-serverless-node-red
npm run win-package && npm run win-deploy
[email protected] win-package C:\Users\mikeh\Documents\aws-serverless-node-red
aws cloudformation package --template ./cloudformation.yaml --s3-bucket %npm_package_config_s3BucketName% --output-template packaged-sam.yaml --region %npm_package_config_region%
while parsing a block mapping
in "", line 47, column 11:
- Effect: "Allow"
^
expected , but found ''
in "", line 52, column 20:
- Effect: "Allow"
^
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] win-package: aws cloudformation package --template ./cloudformation.yaml --s3-bucket %npm_package_config_s3BucketName% --output-template packaged-sam.yaml --region %npm_package_config_region%
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] win-package 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\mikeh\AppData\Roaming\npm-cache_logs\2019-10-05T17_38_33_221Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] win-package-deploy: npm run win-package && npm run win-deploy
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] win-package-deploy 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\mikeh\AppData\Roaming\npm-cache_logs\2019-10-05T17_38_33_270Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] win-setup: npm install && (aws s3api get-bucket-location --bucket %npm_package_config_s3BucketName% --region %npm_package_config_region% || npm run win-create-bucket) && npm run win-package-deploy
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] win-setup 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\mikeh\AppData\Roaming\npm-cache_logs\2019-10-05T17_38_33_313Z-debug.log
Mainly concerned with ease of deployment, but lighter code/faster startup of lambda is also a concern.
Hello. I deployed this following your steps. I put in my account number, bucket name, region, function, and stack name into the node run config command. When I execute the API command from CloudFormation output with a GET request I get this.
GET request to this url
https://numbers.execute-api.us-west-2.amazonaws.com/prod/
I get a 404 with this page.
<title>Error</title>Cannot GET /
Here are the logs that my lambda is putting into CloudWatch.
2018-08-07T20:58:46.094Z ac21638f-9a84-11e8-98df-21d5192a2f92 prepop flows
2018-08-07T20:58:46.201Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:46 - [info]
Welcome to Node-RED
===================
2018-08-07T20:58:46.201Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:46 - [info] Node-RED version: v0.18.7
2018-08-07T20:58:46.201Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:46 - [info] Node.js version: v6.10.3
2018-08-07T20:58:46.202Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:46 - [info] Linux 4.9.93-41.60.amzn1.x86_64 x64 LE
2018-08-07T20:58:46.822Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:46 - [info] Loading palette nodes
2018-08-07T20:58:48.162Z ac21638f-9a84-11e8-98df-21d5192a2f92 save settings
2018-08-07T20:58:48.232Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] ------------------------------------------------------
2018-08-07T20:58:48.232Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] [node-red/rpi-gpio] Info : Ignoring Raspberry Pi specific node
2018-08-07T20:58:48.232Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] ------------------------------------------------------
2018-08-07T20:58:48.232Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] Missing node modules:
2018-08-07T20:58:48.233Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] - node-red-analyze-node (1.0.0): analyze
2018-08-07T20:58:48.233Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] - node-red-encode-node (1.0.0): mediaconvert-encode
2018-08-07T20:58:48.233Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] - node-red-publish-node (1.0.0): publish
2018-08-07T20:58:48.233Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [warn] - node-red-rules-node (1.0.0): rules
2018-08-07T20:58:48.233Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [info] Removing modules from config
2018-08-07T20:58:48.238Z ac21638f-9a84-11e8-98df-21d5192a2f92 save settings
2018-08-07T20:58:48.256Z ac21638f-9a84-11e8-98df-21d5192a2f92 Node-RED server started.
2018-08-07T20:58:48.313Z ac21638f-9a84-11e8-98df-21d5192a2f92 no entry found for key nodered-alex/credential.json
2018-08-07T20:58:48.316Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [info] Starting flows
2018-08-07T20:58:48.318Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:48 - [info] Started flows
2018-08-07T20:58:49.300Z ac21638f-9a84-11e8-98df-21d5192a2f92 no entry found for key nodered-alex/credential.json
2018-08-07T20:58:49.302Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:49 - [info] Stopping flows
2018-08-07T20:58:49.304Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:49 - [info] Stopped flows
2018-08-07T20:58:49.305Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:49 - [info] Starting flows
2018-08-07T20:58:49.305Z ac21638f-9a84-11e8-98df-21d5192a2f92 7 Aug 20:58:49 - [info] Started flows
END RequestId: ac21638f-9a84-11e8-98df-21d5192a2f92
REPORT RequestId: ac21638f-9a84-11e8-98df-21d5192a2f92 Duration: 3433.02 ms Billed Duration: 3500 ms Memory Size: 1024 MB Max Memory Used: 118 MB
START RequestId: dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6 Version: $LATEST
2018-08-07T21:07:21.444Z dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6 no entry found for key nodered-alex/credential.json
2018-08-07T21:07:21.446Z dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6 7 Aug 21:07:21 - [info] Stopping flows
2018-08-07T21:07:21.455Z dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6 7 Aug 21:07:21 - [info] Stopped flows
2018-08-07T21:07:21.455Z dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6 7 Aug 21:07:21 - [info] Starting flows
2018-08-07T21:07:21.455Z dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6 7 Aug 21:07:21 - [info] Started flows
END RequestId: dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6
REPORT RequestId: dfe9f615-9a85-11e8-832c-0b1f2b3a9ad6 Duration: 158.50 ms Billed Duration: 200 ms Memory Size: 1024 MB Max Memory Used: 118 MB ```
When I attempted to run npm run setup, it failed and rolled back the CloudFormation stack because the cloudformation.yaml and packaged-seam.yaml both referred to "nodejs6.10". Changing these to "nodejs.10.x" worked, but I'm not sure if the dependencies were valid.
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.