Errror which crashed the my hosted node.js server file which is run on fore erver command - node.js

My node.js server file which is hosted on a server is used by my various applications like mobile apps and desktop app.
At some time my server file which is run through forever command crashes and my whole front end system goes down. Why does the server file crash?
Type Error: Cannot read property 'fragmentedOperation' of null
at Receiver.endPacket (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket\node_modules\ws\lib\Receiver.js:247:18)
at Receiver.finish (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\Receiver.js:483:12)
at Receiver.<anonymous> (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\Receiver.js:451:33)
at Receiver.add (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\Receiver.js:95:24)
at Socket.realHandler (C:\Users\root\Desktop\Server\windowsnodefiles\node-v6.10.3-win-x64\node_modules\socket.io\node_modules\ws\lib\WebSocket.js:800:20)
at emit One (events.js:96:13)
at Socket.emit (events.js:188:7)
at readability (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at Nonreactive (net.js:547:20)
error: Forever detected script exited with code: 1
error: Script restart attempt #2
Error: %1 is not a valid Win32 application.

If you are using browserSync library then you can check this link
rollback the browserSync version to ^2.6.4 and it works
or try updating your socket.io package as per this link
Please check if your issue is fixed with the latest release

Related

aws-azure-login "Unable to recognize page state!"

I have trawled the net on this one and cannot find a resolution.
I have deployed an EC2 instance from a AWS RHEL 8 AMI.
I have installed all the pre-requisites for aws-azure-login but cannot connect to my accounts over SAML. (https://github.com/sportradar/aws-azure-login)
The config file has been created with parameters. When running aws-azure-login it returns the username, I press enter and then it hangs for minutes and returns the following error:
Unable to recognize page state! A screenshot has been dumped to aws-azure-login-unrecognized-state.png. If this problem persists, try running with --mode=gui or --mode=debug
After running in debug i get the following output:
Logging in with profile 'default'...
Using AWS SAML endpoint https://signin.aws.amazon.com/saml
Error: Failed to launch the browser process!
[13527:13527:1220/050718.762168:ERROR:browser_main_loop.cc(1409)] Unable to open X display.
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/usr/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:197:20)
at Interface.<anonymous> (/usr/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:187:68)
at Interface.emit (events.js:412:35)
at Interface.emit (domain.js:475:12)
at Interface.close (readline.js:530:8)
at Socket.onend (readline.js:254:10)
at Socket.emit (events.js:412:35)
at Socket.emit (domain.js:475:12)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Node version = v14.18.2
Any pointers would be greatly appreciated.
Note: on Linux you will likely need to disable the Puppeteer sandbox
or Chrome will fail to launch:
aws-azure-login --no-sandbox
If not check Unable to open X display when trying to run google-chrome on Centos (Rhel 7.5)
I bumped into same issue on CentOS7
aws-azure-login --profile <profile_name> --no-prompt --no-sandbox --enable-chrome-network-service --no-verify-ssl
worked for me, hope I helped anyone
I was getting the same error but then I end up recreating a new profile name. This time, I made sure that my profile name was one word, all lower case, and only characters was used. Example: automation

Connect to stratum server in NODEJS

I'm trying for several days to connect to a stratum server in nodejs. But I don't get my code working.
I've tried several npm packages but most of them are outdated.
Then I found node-stratum.
This package works fine locally so I expected that it works also with a remote server.
After I changed to host and port to pool.minexmr.com with port number 4444
I got this error message
Oops error: Error: Stratum request without method or result field
at serverForEachCommand (C:\Users\JP\Documents\xmr-web\node_modules\stratum\lib\server.js:350:19)
at arrayEach (C:\Users\JP\Documents\xmr-web\node_modules\stratum\node_modules\lodash\index.js:1289:13)
at Function.<anonymous> (C:\Users\JP\Documents\xmr-web\node_modules\stratum\node_modules\lodash\index.js:3345:13)
at Object.processCommands (C:\Users\JP\Documents\xmr-web\node_modules\stratum\lib\server.js:298:9)
at Object.handleData (C:\Users\JP\Documents\xmr-web\node_modules\stratum\lib\client.js:138:38)
at Socket.twoArgs (C:\Users\JP\Documents\xmr-web\node_modules\better-curry\index.js:74:18)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
I used to code in the example/client
My full code is here codepile
I also tried to change the host to miningpoolhub but there I got no error and it stops by the console.log('Sent!') so I figured out that I better stick with pool.minexmr.com
In the codepile I also added the other logs from the terminal
Okay, finally I got the answer.
Monero stratum has a different payload than Bitcoin
With Wireshark I filtered the payload out en changed the client code van node-stratum.
I changed the node-stratum core code a bit too.

MongoDB error while installing Rocket.chat in CentOS 8 server with Apache

I am following this tutorial to install a Rocket.chat server in CentOS:
https://hostpresto.com/community/tutorials/how-to-install-rocket-chat-server-on-centos-7/
I am new to mongodb and node.js so I am not very familiar with how all this works
At the moment I am looking for something simple that just works
When I reach the step where it says to execute
node main.js
I get the following error:
[username#localhost Rocket.chat]$ node main.js
/opt/Rocket.chat/programs/server/node_modules/fibers/future.js:313
throw(ex);
^
MongoError: not master and slaveOk=false
at Connection.<anonymous> (/opt/Rocket.chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/pool.js:450:61)
at Connection.emit (events.js:310:20)
at processMessage (/opt/Rocket.chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connection.js:384:10)
at Socket.<anonymous> (/opt/Rocket.chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connection.js:553:15)
at Socket.emit (events.js:310:20)
at addChunk (_stream_readable.js:286:12)
at readableAddChunk (_stream_readable.js:268:9)
at Socket.Readable.push (_stream_readable.js:209:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
ok: 0,
errmsg: 'not master and slaveOk=false',
code: 13435,
codeName: 'NotMasterNoSlaveOk',
[Symbol(mongoErrorContextSymbol)]: {}
}
The tutorial says I should be able to see the Rocket.chat web interface if I go to https://yourdomain.com:3000 but I get an unable to connect page, which I suppose is due to the error above
The tutorial also says node main.js is to check if MongoDB is running or not. I can see that MongoDb service is running by executing
systemctl status mongod
so this error seems to be caused by something else.
How do I find out what is causing this error? Or are there any mistakes in this tutorial? I have found other tutorials regarding installing Rocket.chat in CentOS but most of them use nginx as hte web server while I need to use Apache.

Mongoose Can't Connect Without Internet

I have my MongoDB server running on localhost:27017, and while I can usually run my Node.js app fine, when I disconnect from the internet Mongoose throws the error
Error: failed to connect to [localhost:27017]
Note that I can still connect to the MongoDB server from the Mongo shell client. Also, if I start up my app first and then lose internet connection, my app can access the database fine offline. So why can't it start up without internet?
EDIT: here is the error in full
events.js:85
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at null.<anonymous> (<My App>\node_modules\mongoose\
node_modules\mongodb\lib\mongodb\connection\server.js:555:74)
at emit (events.js:118:17)
at null.<anonymous> (<My App>\node_modules\mongoose\
node_modules\mongodb\lib\mongodb\connection\connection_pool.js:156:15)
at emit (events.js:110:17)
at Socket.<anonymous> (<My App>\node_modules\mongoos
e\node_modules\mongodb\lib\mongodb\connection\connection.js:534:10)
at Socket.emit (events.js:107:17)
at net.js:923:16
at process._tickCallback (node.js:355:11)
[nodemon] app crashed - waiting for file changes before starting...
Edit: wording
Use 127.0.0.1 instead of localhost. By turning off your wifi interface the OS is no longer able to resolve localhost.
Consider node-offline-localhost.
Add the following before the breaking code:
require('node-offline-localhost').always();
And it just works (hopefully), at least until RFC 3493 gets fixed.
Full disclosure: I authored this package to streamline https in my dev environment when offline.

error when starting the server with grunt or node server

I am trying to use the mean stack as described here : http://mean.io/
after install, when making "grunt", there is an error :
debugger listening on port 5858
4 Jan 01:47:40 - [nodemon] reading ignore list
Express app started on port 3000
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
at EventEmitter.emit (events.js:106:17)
at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
4 Jan 01:47:40 - [nodemon] app crashed - waiting for file changes before starting...
I tried the troubleshooting as specified on the site : Updating Grunt, bower and cleaning npm and bower caches worked well. but updating npm gives an error too:
npm ERR! error rolling back Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm
This looks like a conflict between homebrew and npm.
but anyway i have version 1.3.21 installed.
There is the same error when i am trying node server.
do you have an idea on what i can do to make the server work ?
It may be too easy, but seems like your MongoDB server is not actually running. After having installed Mongo (on your Mac, I assume?), you have to open a Terminal window/tab, run mongod and leave it running (or use screen, etc.). You can try to access MongoDB CLI by typing mongo to make sure the server is running.
#desgnl: if you don't want to run mongod command everytime you are running the grunt, you can always use third party services like MongoDB Hosting: Database-as-a-Service by MongoLab https://mongolab.com Hope this helps too!

Resources