RabbitMQ + Node.JS Connection issue, frame size too large? - node.js

I have been playing around with RabbitMQ with apache + php and wanted to see how it compared to Node.JS in performance.
Using the latest node.js (0.4.12) and amqp module (npm install amqp), i get a unknown exception connecting which it seems like it is the frame size causing error (line 181 in amqp.js), removing the error from the code just throws another related to allocating too large of an array size.
the RabbitMQ server is is just a "apt-get install rabbitmq-server" with default configuration. This works in PHP just fine.
Starting ... AMQP URL: amqp://localhost
events.js:47
throw new Error("Uncaught, unspecified 'error' event.");
^
Error: Uncaught, unspecified 'error' event.
at Connection.emit (events.js:47:15)
at AMQPParser.onError (/nodeJS_stuff/node_modules/amqp/amqp.js:839:12)
at AMQPParser.throwError (/nodeJS_stuff/node_modules/amqp/amqp.js:145:25)
at AMQPParser.execute (/nodeJS_stuff/node_modules/amqp/amqp.js:181:18)
at Connection.<anonymous> (/nodeJS_stuff/node_modules/amqp/amqp.js:851:12)
at Connection.emit (events.js:64:17)
at Connection._onReadable (net.js:672:14)
at IOWatcher.onReadable [as callback] (net.js:177:10)
Any one ever run into this? i have tried a couple examples and i always get this. i am running this on EC2 as well, if that helps any.

I just saw this problem today. It seemed to me like a mismatch between the versions of rabbitmq and amqp. I was testing two versions of node-amqp (0.0.2 and 0.1.0) and rabbitmq (1.7.2 and 2.3.1). I found out that node-amqp 0.0.2 works with both versions of rabbitmq, but the newer node-amqp (0.1.0, actually as of version 0.0.6) doesn't work with the older rabbitmq. So try rolling back your node-amqp to an older version and see if it works.

It is definitely a version mismatch between amqp and the installed version of RabbitMQ. The problem is most probably due to rabbitmq-server being too old. I had the exactly same problem on my Debian machine and the RabbitMQ installation guide pointed me to the right direction.
Uninstall your current version of rabbitmq-server and download the most recent one from the RabbitMQ website.

Related

How to resolve nodejs deprecation warning - RFC 6066

I am trying to create a sample nodejs app for kafkajs producer and consumer. When I start the app, I get the deprecation error. So, I tried with --trace-deprecation flag and get this stack trace. How can I fix it? I tried using different versions of kafkajs, but still keep getting this error
(node:61452) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
at Object.connect (node:_tls_wrap:1670:15)
at /BitBucketRepos/node-js/SimpleProducerConsumer/node_modules/kafkajs/src/network/socketFactory.js:12:13
at module.exports (/BitBucketRepos/node-js/SimpleProducerConsumer/node_modules/kafkajs/src/network/socket.js:24:18)
at /BitBucketRepos/node-js/SimpleProducerConsumer/node_modules/kafkajs/src/network/connection.js:240:23
at new Promise (<anonymous>)
at Connection.connect (/BitBucketRepos/node-js/SimpleProducerConsumer/node_modules/kafkajs/src/network/connection.js:167:12)
at ConnectionPool.getConnection (/BitBucketRepos/node-js/SimpleProducerConsumer/node_modules/kafkajs/src/network/connectionPool.js:56:24)
at Broker.connect (/BitBucketRepos/node-js/SimpleProducerConsumer/node_modules/kafkajs/src/broker/index.js:86:52)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /BitBucketRepos/node-js/SimpleProducerConsumer/node_modules/kafkajs/src/cluster/brokerPool.js:319:9
I have tried with using ksfkajs version 1.15.0, 1.16.0, 2.1.0 in package.json - but keep getting the same error.
How can I eliminate this warning?
Thank you
Upgrade your NodeJS version should resolve this
https://techiedan.com/nodejs-ip-address-is-not-permitted-by-rfc-6066/
Upgrade your NodeJS version into the newest stable release. At time of writing, this is at version 15 which should resolve this issue as I believe the IP address is now ignored in future version.

**ERROR! Callback called multiple times** JHipster version 7.3.1 (latest) having Error in Node

I have used other versions of JHipster but that one in my mac is not working fine, I am trying to generate a simple gateway (no entities yet), and after executing:
$jhipster
Filling the application metadata, I just got:
ERROR! Callback called multiple times
Error [ERR_MULTIPLE_CALLBACK]: Callback called multiple times
at NodeError (node:internal/errors:371:5)
at onFinish (node:internal/streams/writable:667:37)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:526:9)
at processTimers (node:internal/timers:500:7) {
code: 'ERR_MULTIPLE_CALLBACK'
So, according to #MattRaible and #GaelMariou, when having the ERROR! Callback called multiple times when generating JHipter applications or entities, you should verify the Node JS version. That version is provided in pom.xml or build.gradle, however, I never found a reference of node version in pom.xml (I use maven).
It is not clear where to get the exact version, nevertheless there is this article that states the same problem using node.js version bigger than 14: https://github.com/jhipster/generator-jhipster/issues/16744.
Meaning you should keep your node.js in version 14 until they solve that issue. I changed to v14.18.1, and now it is working sharp.

What's "EIO: i/o error, write" in node.js and how do I eliminate it?

I have a node.js app using elasticsearch to gather error data and notify relevant stack holders. It starts to give me errors lately (no change has made to the code):
write EIO
Error: write EIO
at afterWriteDispatched (internal/stream_base_commons.js:154:25)
at writeGeneric (internal/stream_base_commons.js:145:3)
at WriteStream.Socket._writeGeneric (net.js:783:11)
at WriteStream.Socket._write (net.js:795:8)
at doWrite (_stream_writable.js:385:12)
at writeOrBuffer (_stream_writable.js:367:5)
at WriteStream.Writable.write (_stream_writable.js:307:12)
at Stdio.write (/project/node_modules/elasticsearch/src/lib/loggers/stdio.js:58:6)
at Stdio.onError (/project/node_modules/elasticsearch/src/lib/loggers/stdio.js:70:8)
at Log.wrapper (/project/node_modules/lodash/lodash.js:4929:19)
at Log.emit (events.js:315:20)
at Log.error (/project/node_modules/elasticsearch/src/lib/log.js:239:17)
at checkRespForFailure (/project/node_modules/elasticsearch/src/lib/transport.js:298:18)
at HttpConnector.<anonymous> (/project/node_modules/elasticsearch/src/lib/connectors/http.js:171:7)
at ClientRequest.wrapper (/project/node_modules/lodash/lodash.js:4929:19)
at ClientRequest.emit (events.js:315:20)
I suspect this has to do with some type of I/O error on the disk. What can I do to eliminate the error? I am using Node.js v14.0.0 and elasticsearch (npm package) 16.7.1.
This can be caused by multiple reasons:
If you are using Windows is most likely a unicode issue you can fix by executing chp command like this chcp 850 but if you need Unicode characters then iconv-lite module should help
When trying to write to a closed terminal
Disk related issues, like the disk is full or OS issues... when trying to write the output
Try to reinstall the modules to the latest version and from scratch since maybe you are using a buggy module or it wasn't installed correctly
This turns out to be a bug in ElasticSearch's log feature due to the fact it is writing to the stdio synchronously. We will either have to turn off the log or use a third party logger.

How can I update Node.JS through JXCore?

I'm getting this error when trying to use the Steam API:
var cryptedSessKey = require('crypto').publicEncrypt(fs.readFileSync(__dirna
^
TypeError: Object # has no method 'publicEncrypt'
at SteamClient.handlers.(anonymous function) (/usr/local/psa/var/modules/jxcore-support/native_modules/node_modules/steam/lib/steam_client.js:150:42)
at SteamClient.netMsgReceived (/usr/local/psa/var/modules/jxcore-support/native_modules/node_modules/steam/lib/steam_client.js:106:26)
at Connection.emit (events.js:82:15)
at Connection._readPacket (/usr/local/psa/var/modules/jxcore-support/native_modules/node_modules/steam/lib/connection.js:50:8)
at Connection.emit (events.js:79:15)
at emitReadable (_stream_readable.js:383:10)
at emitReadable (_stream_readable.js:379:5)
at readableAddChunk (_stream_readable.js:143:31)
at Connection.Readable.push (_stream_readable.js:107:10)
at TCP.onread (net.js:489:18)
Spawner error: Application exited by itself with code: 8
Spawner info: Subscribing is delayed by 2000 ms.
Spawner info: Subscribed successfully: Successfully subscribed process 25525 to the monitor.
The fix is to apparently upgrade my node.js to version v0.12. As stated here: https://github.com/seishun/node-steam/issues/121
How can I do this? I'm using JXCore extension for Plesk.
I've tried SSHing in and running update commands but it doesn't seem to recognise node. Do I have to browse to a certain directory? I can't even run node --version because it's all within JXCore (I assume).
I have the lastest version of JXCore (Installed v Beta-0.3.0.2).
I'm assuming I'm just being an idiot somehow but I'm still new to node.js.
Can anyone help me?
Thank you
Jack
I asked the same question on their Github and this was their response:
JXcore v 0.3 is based on Node 0.10. AFAIK that module has node 0.10
compatible version too. You should use that. We are planning to bring
new crypto API from 0.12 soon.
Therefore, for now, you can't update it.

Node with Opa app crashes when trying to connect to unavailable CouchDB

I am working on Opa app using CouchDB as a database backend. When fetching a document with API function CouchDd.Document.get (API doc) and the DB server is down, my app crashed:
/opt/mlstate/lib/opa/stdlib/server.opp/serverNodeJsPackage.js:169
,(global.hasOwnProperty("toString") && global.toString || undefined)(e));}req.
^
TypeError: undefined is not a function
at ClientRequest.on_error (/opt/mlstate/lib/opa/stdlib/server.opp/serverNodeJsPackage.js:169:489)
at ClientRequest.EventEmitter.emit (events.js:88:17)
at Socket.socketErrorListener (http.js:1320:9)
at Socket.EventEmitter.emit (events.js:88:17)
at Socket._destroy.self.errorEmitted (net.js:329:14)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
and returns to shell prompt. I am running the app with ./myapp --nodb, because I do not use the build-in support for the MongoDB.
The CouchDb.Document.get function returns either {success: {FormatedJson: ...}} or {failure}. I expected that parsing the result for the {failure} is enough to catch all the network connection problems. What else should I do?
I am using Opa framework version 1.0.5 on OSX (11.4.0 Darwin) from the standard package on the Opa website, Node.js v0.8.3 and CouchDB 1.2.0.
This was a bug in 1.0.5, but it's been fixed already. You can get the sources for the fixed version here, but an official package hasn't been released yet.

Resources