Node-red email node keeps crashing - email

I have a simple email node and debug-node set-up within a web application using node red.
The email node has refresh time set to 5 seconds. and protocol IMAP.
I have a gmail account logged in.
Node-red crashes with the following error:
(Happens rather quickly when I receive an email with an attachment of > 10mb).
The TypeError is on different properties like 'name', 'type' '11456' etc...
10 Jul 17:00:28 - [info] Starting flows
10 Jul 17:00:28 - [info] Started flows
10 Jul 17:00:37 - [red] Uncaught Exception:
10 Jul 17:00:37 - TypeError: Cannot set property 'name' of undefined
at Connection.<anonymous> (/usr/lib/node_modules/node-red/node_modules/imap/lib/Connection.js:431:22)
at Connection._resTagged (/usr/lib/node_modules/node-red/node_modules/imap/lib/Connection.js:1535:22)
at Parser.<anonymous> (/usr/lib/node_modules/node-red/node_modules/imap/lib/Connection.js:194:10)
at emitOne (events.js:116:13)
at Parser.emit (events.js:211:7)
at Parser._resTagged (/usr/lib/node_modules/node-red/node_modules/imap/lib/Parser.js:175:10)
at Parser._parse (/usr/lib/node_modules/node-red/node_modules/imap/lib/Parser.js:139:16)
at Parser._tryread (/usr/lib/node_modules/node-red/node_modules/imap/lib/Parser.js:82:15)
at TLSSocket.Parser._cbReadable (/usr/lib/node_modules/node-red/node_modules/imap/lib/Parser.js:53:12)
at emitNone (events.js:106:13)
Versions:
10 Jul 17:00:27 - [info] Node-RED version: v0.18.7
10 Jul 17:00:27 - [info] Node.js version: v8.11.3
10 Jul 17:00:27 - [info] Linux 4.15.0-24-generic x64 LE
Package.json :
"dependencies": {
"imap": "^0.8.19",
"mailparser": "^0.6.2",
"nodemailer": "^1.11.0",

Related

While running Pact- Karma-Mocha framework, getting error - 'Can't find variable: Pact'

I am trying to get sample PACT JS framework (any variant) running for Contract testing. Initial plan is just to get the sample(s) provided get running & then later on make changes into End point and customise for our own purpose.
PACT Foundation link: https://github.com/pact-foundation/pact-js/tree/master/karma/mocha
Environment:
Win 7
Node: v8.11.4
dependencies installed:
"#pact-foundation/karma-pact": {
"version": "2.1.8",
"#pact-foundation/pact-node": {
"version": "6.19.11",
I am getting following error while trying to get it running.
Command: karma start karma.conf.js
C:\VarProjects\VanillaMocha>karma start test/karma.conf.js
10 09 2018 09:53:34.544:ERROR [config]: File C:\VarProjects\VanillaMocha\test\karma.conf.js does not exist!
C:\VarProjects\VanillaMocha>karma start karma.conf.js
[2018-09-10T08:53:42.384Z] INFO: pact-node#6.19.11/16892 on W5167037:
Creating Pact Server with options:
port = 1234,
consumer = KarmaMochaConsumer,
provider = KarmaMochaProvider,
logLevel = DEBUG,
log = C:\VarProjects\VanillaMocha\logs\pact.log,
dir = C:\VarProjects\VanillaMocha\pacts,
pactFileWriteMode = overwrite,
ssl = false,
cors = false,
host = localhost
[2018-09-10T08:53:42.401Z] INFO: pact-node#6.19.11/16892 on W5167037: Created 'standalone\win32-1.54.4\bin\pact-mock-service.bat service --port '1234' --consumer 'KarmaMochaConsumer
' --provider 'KarmaMochaProvider' --log-level 'DEBUG' --log 'C:\VarProjects\VanillaMocha\logs\pact.log' --pact_dir 'C:\VarProjects\VanillaMocha\pacts' --pact-file-write-mode 'overwri
te' --host 'localhost'' process with PID: 18912
10 09 2018 09:53:44.980:INFO [pact]: Pact Mock Server running on port: 1234
10 09 2018 09:53:45.054:WARN [watcher]: Pattern "C:/dist-web/pact-web.js" does not match any file.
10 09 2018 09:53:45.092:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
10 09 2018 09:53:45.093:INFO [launcher]: Launching browser PhantomJS_without_security with unlimited concurrency
10 09 2018 09:53:45.101:INFO [launcher]: Starting browser PhantomJS
10 09 2018 09:53:46.811:INFO [PhantomJS 2.1.1 (Windows 7 0.0.0)]: Connected on socket qMhVUJZzdDCD_YuKAAAA with id 47921548
PhantomJS 2.1.1 (Windows 7 0.0.0) Client "before all" hook FAILED
Can't find variable: Pact
client-spec.js:10:32
PhantomJS 2.1.1 (Windows 7 0.0.0) Client "after all" hook FAILED
undefined is not an object (evaluating 'provider.finalize')
client-spec.js:21:28
PhantomJS 2.1.1 (Windows 7 0.0.0): Executed 2 of 4 (2 FAILED) ERROR (0.013 secs / 0.001 secs)
[2018-09-10T08:53:46.985Z] INFO: pact-node#6.19.11/16892 on W5167037: Removing all Pact servers.
[2018-09-10T08:53:46.986Z] INFO: pact-node#6.19.11/16892 on W5167037: Removing Pact with PID: 18912
C:\VarProjects\VanillaMocha>KARMA start
[2018-09-10T08:54:14.809Z] INFO: pact-node#6.19.11/7492 on W5167037:
Creating Pact Server with options:
port = 1234,
consumer = KarmaMochaConsumer,
provider = KarmaMochaProvider,
logLevel = DEBUG,
log = C:\VarProjects\VanillaMocha\logs\pact.log,
dir = C:\VarProjects\VanillaMocha\pacts,
pactFileWriteMode = overwrite,
ssl = false,
cors = false,
host = localhost
[2018-09-10T08:54:14.823Z] INFO: pact-node#6.19.11/7492 on W5167037: Created 'standalone\win32-1.54.4\bin\pact-mock-service.bat service --port '1234' --consumer 'KarmaMochaConsumer'
--provider 'KarmaMochaProvider' --log-level 'DEBUG' --log 'C:\VarProjects\VanillaMocha\logs\pact.log' --pact_dir 'C:\VarProjects\VanillaMocha\pacts' --pact-file-write-mode 'overwrit
e' --host 'localhost'' process with PID: 2920
10 09 2018 09:54:17.376:INFO [pact]: Pact Mock Server running on port: 1234
10 09 2018 09:54:17.447:WARN [watcher]: Pattern "C:/dist-web/pact-web.js" does not match any file.
10 09 2018 09:54:17.483:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
10 09 2018 09:54:17.484:INFO [launcher]: Launching browser PhantomJS_without_security with unlimited concurrency
10 09 2018 09:54:17.489:INFO [launcher]: Starting browser PhantomJS
10 09 2018 09:54:19.243:INFO [PhantomJS 2.1.1 (Windows 7 0.0.0)]: Connected on socket rn-kwBRGhJbyUwvZAAAA with id 54614606
PhantomJS 2.1.1 (Windows 7 0.0.0) Client "before all" hook FAILED
Can't find variable: Pact
client-spec.js:10:32
PhantomJS 2.1.1 (Windows 7 0.0.0) Client "after all" hook FAILED
undefined is not an object (evaluating 'provider.finalize')
client-spec.js:21:28
PhantomJS 2.1.1 (Windows 7 0.0.0): Executed 2 of 4 (2 FAILED) ERROR (0.012 secs / 0 secs)
Kindly advise, Thanks a lot
The code is failing because it's missing pact-web. You can see this in the error message you included:
Pattern "C:/dist-web/pact-web.js" does not match any file.
This is happening because you're using the example karma.conf.js outside the example repository without modification.
Quoting the relevant part of karma.conf.js:
// if you are using this example to setup your own project
// load pact from the node_modules directory
'../../dist-web/pact-web.js',
// Example Using NPM package
// 'node_modules/#pact-foundation/pact-web/pact-web.js',
Looking at your directory structure, commenting this line:
'../../dist-web/pact-web.js',
and uncommenting this line:
// 'node_modules/#pact-foundation/pact-web/pact-web.js',
should solve your problem.
Note that you also need to ensure that #pact-foundation/pact-web is a dev-dependency:
npm install --save-dev '#pact-foundation/pact-web'

nodered on Raspberry PI is not starting any longer

I am not quite sure what node is causing this behaviour and there are tooo many flows so I can not install from scratch and yes I do not have a backup of them.
I realized today in the morning that I can not access the http gui of my nodered instance any longer on my raspberrypi zero. Just edited some flows but nothing real serious.
I am trying to start my node red on my Rapsberry PI zere and no GUI and UI is starting up to access the node red instance. I don't know how to solve and troubleshoot this. What I am doing or trying to do is:
pi#nodered-pi:~/.node-red $ node-red-start
Start Node-RED
Once Node-RED has started, point a browser at http://192.168.1.42:1880
On Pi Node-RED works better with the Firefox or Chrome browser
Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot
To find more nodes and example flows - go to http://flows.nodered.org
Starting as a systemd service.
Started Node-RED graphical event wiring tool.
19 Aug 15:13:55 - [info]
Welcome to Node-RED
===================
19 Aug 15:13:55 - [info] Node-RED version: v0.18.7
19 Aug 15:13:55 - [info] Node.js version: v8.11.1
19 Aug 15:13:55 - [info] Linux 4.14.52+ arm LE
19 Aug 15:14:06 - [info] Loading palette nodes
19 Aug 15:14:37 - [info] Dashboard version 2.9.6 started at /ui
19 Aug 15:14:49 - [warn] ------------------------------------------------------
19 Aug 15:14:49 - [warn] [node-red-contrib-delta-timed/delta-time] 'delta' already registered by module node-red-contrib-change-detect
19 Aug 15:14:49 - [warn] ------------------------------------------------------
19 Aug 15:14:49 - [info] Settings file : /home/pi/.node-red/settings.js
19 Aug 15:14:49 - [info] User directory : /home/pi/.node-red
19 Aug 15:14:49 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
19 Aug 15:14:49 - [info] Flows file : /home/pi/.node-red/flows_nodered-pi.json
19 Aug 15:14:50 - [info] Server now running at http://127.0.0.1:1880/
19 Aug 15:14:50 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
19 Aug 15:14:50 - [warn] Error loading credentials: SyntaxError: Unexpected token T in JSON at position 0
19 Aug 15:14:50 - [warn] Error loading flows: Error: Failed to decrypt credentials
19 Aug 15:14:51 - [info] Starting flows
19 Aug 15:15:01 - [warn] [telegram receiver:Telegram Receiver] bot not initialized
19 Aug 15:15:01 - [warn] [telegram sender:Temperatur Wetterstation] bot not initialized.
19 Aug 15:15:01 - [error] [function:Versorge mit Information] SyntaxError: Invalid or unexpected token
19 Aug 15:15:01 - [info] Started flows
19 Aug 15:15:02 - [info] [sonoff-server:166ef3ba.0029bc] SONOFF Server Started On Port 1080
19 Aug 15:15:02 - [red] Uncaught Exception:
19 Aug 15:15:02 - Error: listen EACCES 0.0.0.0:443
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
19 Aug 15:15:20 - [info]
Welcome to Node-RED
===================
19 Aug 15:15:20 - [info] Node-RED version: v0.18.7
19 Aug 15:15:02 - Error: listen EACCES 0.0.0.0:443
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
This error implies that something else is already running on port 443. This could be an existing copy of Node-RED or something else. You can search what applications are listening on what ports with the following command
lsof -i :443
This will list what is listening on port 443

Node-red looping on start raspberry pi

I was using node-red in my raspberry pi normally until get the brillant idea to install new nodes.
Now, I am unable to start it. The node-red is in loop when starting.
> Start Node-RED Once Node-RED has started, point a browser at
> http://192.168.0.113:1880 On Pi Node-RED works better with the Firefox
> or Chrome browser Use node-red-stop to
> stop Node-RED Use node-red-start to start
> Node-RED again Use node-red-log to view
> the recent log output Use sudo systemctl enable nodered.service to
> autostart Node-RED at every boot Use sudo systemctl disable
> nodered.service to disable autostart on boot To find more nodes and
> example flows - go to http://flows.nodered.org Starting as a systemd
> service. Started Node-RED graphical event wiring tool.. 10 Jan
> 00:29:50 - [info] Welcome to Node-RED
> =================== 10 Jan 00:29:50 - [info] Node-RED version: v0.17.5 10 Jan 00:29:50 - [info] Node.js version: v6.12.3 10 Jan 00:29:50 -
> [info] Linux 4.9.35-v7+ arm LE 10 Jan 00:29:51 - [info] Loading
> palette nodes [../deps/mpg123/src/output/alsa.c:165] error: cannot
> open device default node: pcm_params.c:2286: snd_pcm_hw_refine:
> Assertion `pcm && params' failed. nodered.service: main process
> exited, code=killed, status=6/ABRT Unit nodered.service entered failed
> state. nodered.service holdoff time over, scheduling restart. Stopping
> Node-RED graphical event wiring tool.... Starting Node-RED graphical
> event wiring tool.... Started Node-RED graphical event wiring tool..
> 10 Jan 00:29:57 - [info] Welcome to Node-RED
> =================== 10 Jan 00:29:57 - [info] Node-RED version: v0.17.5 10 Jan 00:29:57 - [info] Node.js version: v6.12.3 10 Jan 00:29:57 -
> [info] Linux 4.9.35-v7+ arm LE 10 Jan 00:29:58 - [info] Loading
> palette nodes [../deps/mpg123/src/output/alsa.c:165] error: cannot
> open device default node: pcm_params.c:2286: snd_pcm_hw_refine:
> Assertion `pcm && params' failed. nodered.service: main process
> exited, code=killed, status=6/ABRT Unit nodered.service entered failed
> state. nodered.service holdoff time over, scheduling restart. Stopping
> Node-RED graphical event wiring tool.... Starting Node-RED graphical
> event wiring tool.... Started Node-RED graphical event wiring tool..
> 10 Jan 00:30:04 - [info] Welcome to Node-RED
> =================== 10 Jan 00:30:04 - [info] Node-RED version: v0.17.5 10 Jan 00:30:04 - [info] Node.js version: v6.12.3 10 Jan 00:30:04 -
> [info] Linux 4.9.35-v7+ arm LE 10 Jan 00:30:05 - [info] Loading
> palette nodes
Go to the directory /home/pi/.node-red and open the package.json file.
It should contain a dependencies section that lists the extra nodes you installed (assuming you did so via the Palette Manager in the editor). Identify any nodes related to playing audio - the crashing error is related to trying to use the mpg123 command line tool for playing audio files.
Then on the command line, run npm remove NAME-OF-MODULE --save.
Node-RED should then restart cleanly.

IoTP boilerplate application not working after Diego migration

After migrating my Watson IoTP boilerplate application to Diego, it not longer starts. I see this in the log:
[APP/0] OUT Welcome to Node-RED
[APP/0] OUT ===================
[APP/0] OUT 18 Jan 15:43:16 - [info] Node-RED version: v0.15.3
[APP/0] OUT 18 Jan 15:43:16 - [info] Node.js version: v4.6.2
[APP/0] OUT 18 Jan 15:43:16 - [info] Linux 4.4.0-45-generic x64 LE
[APP/0] OUT 18 Jan 15:43:16 - [info] Loading palette nodes
[APP/0] OUT 18 Jan 15:43:18 - [warn] [ibm hdfs in] Deprecated call to RED.runtime.nodes.registerType - node-set name must be provided as first argument
[APP/0] OUT 18 Jan 15:43:18 - [warn] [ibm hdfs] Deprecated call to RED.runtime.nodes.registerType - node-set name must be provided as first argument
[APP/0] OUT 18 Jan 15:43:18 - [warn] [ibmpush] Deprecated call to RED.runtime.nodes.registerType - node-set name must be provided as first argument
[APP/0] OUT 18 Jan 15:43:20 - [info] Settings file : /home/vcap/app/bluemix-settings.js
[APP/0] OUT 18 Jan 15:43:20 - [info] Server now running at http://127.0.0.1:`**1880**`/red/
[APP/0] OUT 18 Jan 15:43:20 - [info] Starting flows
[APP/0] OUT 18 Jan 15:43:20 - [info] Started flows
[CELL/0] ERR Timed out after 1m0s: health check never passed.
[CELL/0] OUT Exit status 0
[CELL/0] OUT Destroying container
[API/8] OUT App instance exited with guid ca3f2bbd-ac6e-42ec-8a61-1ff704274c3e payload: {"instance"=>"", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"2 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* Exited with status 4\n* 2 error(s) occurred:\n\n* cancelled\n* process did not exit", "crash_count"=>2, "crash_timestamp"=>1484754267594231230, "version"=>"0361fa77-694c-4e8f-991e-0c52dd0c4c87"}
How can I fix this ?
The problem is that the way apps find the port to bind to has changed with Diego. The VCAP_APP_PORT environment variable is no longer populated by default. To fix it, you need to create a git repo for your app (Overview tab -> Continuous Delivery -> Add GIT). Use jazzhub to edit the bluemix-settings.js file to change
uiPort: process.env.VCAP_APP_PORT
to
uiPort: process.env.PORT
Deploy those changes and the app should start.
I had a similar issue with a npm express app and fixed it without having to edit the bluemix-settings.js file.
Simple remove all references to process.env.VCAP_APP_HOST (no longer a reference in Diego) and change process.env.VCAP_APP_PORT to process.env.PORT.
for example,
var host = 'localhost';
var port = (process.env.PORT || 1337);
app.listen(port, host);
console.log('App started on port ' + port);
You can check to see if your app is running Diego by typing:
cf has-diego-enabled APPNAME
after installing the diego cli tool
cf install-plugin Diego-Enabler -r CF-Community
I also disabled health checks:
cf set-health-check APPNAME none

IHS webserver connecting to websphere application server

I have one applicaion server having multiple nodes. When I am connecting the application through application server, it is working fine. But when I am connecting the application through webserver, it is not working for one node and for all other nodes it works.
What would be the possible cause. I have re-configured the plugin for that particular node many a times. no luck.
I see below logs in plugin log (date may change):
*[Mon Aug 10 11:53:50 2009] 00001dec 00001e04 - ERROR: ws_common: websphereGetStream: Failed to connect to app server on host 'windowsinternal.pt', OS err=78
[Mon Aug 10 11:53:51 2009] 00001dec 00001e04 - ERROR: ws_common: websphereGetStream: Failed to connect to app server on host 'windowsinternal.pt', OS err=78
[Mon Aug 10 11:53:51 2009] 00001dec 00001e04 - ERROR: ws_common: websphereExecute: Failed to create the stream
[Mon Aug 10 11:53:51 2009] 00001dec 00001e04 - ERROR: ws_common: websphereHandleRequest: Failed to execute the transaction to 'windowsinternalNode01_server1'on host 'windowsinternal.pt'; will try another one
[Mon Aug 10 11:53:51 2009] 00001dec 00001e04 - ERROR: ws_common: websphereWriteRequestReadResponse: Failed to find an app server to handle this request
[Mon Aug 10 11:53:51 2009] 00001dec 00001e04 - ERROR: ESI: getResponse: failed to get response: rc = 2
[Mon Aug 10 11:53:51 2009] 00001dec 00001e04 - ERROR: ws_common: websphereHandleRequest: Failed to handle request
[Mon Aug 10 11:53:52 2009] 00001dec 000015b4 - ERROR: ws_common: websphereGetStream: Failed to connect to app server on host 'windowsinternal.pt', OS err=78*
this issue was resolved. There was firewall issue with the default secure port. I just changed the port and it worked.