Can't run redis-node-client test code - node.js

I downloaded node.js (.3), redis (2.0.4), and redis-node-client (git clone). When I start the redis server in one window, then go to the node-client folder and run
node test/test.js
I get
........................................
node.js:66
throw e; // process.nextTick error, or 'error' event on first tick
^
Maximum call stack size exceeded
I'm using the default configs at the moment. Haven't changed anything. Any ideas?

Hm, turns out to be version incompatibilities. Going to v0.2.5 fixes it.
Edit: nevermind, no it doesn't. Comes up with new error:
AssertionError: "testZINTER" "ERR unknown command 'zinter'"
at /Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/test/test.js:121:25
at Client.onReply_ (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:400:34)
at /Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:143:30
at ReplyParser.feed (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:160:55)
at Stream.<anonymous> (/Users/vhwanger/Dropbox/Programming/nodejs/redis-node-client/lib/redis-client.js:337:28)
at Stream.emit (events:27:15)
at IOWatcher.callback (net:489:16)
at node.js:773:9

Sadly, redis-node-client is no longer maintained. That's why I've written node_redis, which you can get with:
npm install redis
There are a lot of people using it now, and this has helped us work out a lot of bugs. Let me know if you have any issues with it.

Related

Firebase Can't Deploy

I have a firebase project I've been maintaining for months and haven't had any problems with.
I've tried running firebase deploy multiple times to no avail. I've googled it and searched on SO, github, and others, found these links, none of which worked. I've tried updating firebase tools, uninstalling and reinstalling, and everything between. Please don't blindly flag as duplicate without reading.
The first line of my error looks like this:
\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js:307
throw ex;
Here's my full output:
firebase deploy
C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js:307
throw ex;
^
Error: write after end
at writeAfterEnd (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_writable.js:261:12)
at PassThrough.Writable.write (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_writable.js:305:21)
at File.log (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\transports\file.js:185:34)
at File._write (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston-transport\index.js:103:17)
at doWrite (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\readable-stream\lib_stream_writable.js:428:64)
at writeOrBuffer (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\readable-stream\lib_stream_writable.js:417:5)
at File.Writable.write (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\readable-stream\lib_stream_writable.js:334:11)
at DerivedLogger.ondata (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:681:20)
at DerivedLogger.emit (events.js:203:15)
at DerivedLogger.EventEmitter.emit (domain.js:448:20)
at addChunk (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:298:12)
at readableAddChunk (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:280:11)
at DerivedLogger.Readable.push (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_readable.js:241:10)
at DerivedLogger.Transform.push (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_transform.js:139:32)
at DerivedLogger._transform (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\lib\winston\logger.js:305:12)
at DerivedLogger.Transform._read (C:\Users\justi\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\winston\node_modules\readable-stream\lib_stream_transform.js:177:10)
I'm completely stuck on this, I've been searching for an hour, and I've never had this fail for me before, so I don't know what's going on with firebase. Thanks in advance.
For others that come this way, I had this exact error message and stack trace. I was attempting to run firebase deploy --except functions while following this code lab step.
For me the fix was simply to stop serving the firebase app locally for debug.
Once I had done this, no reboot, just back in the other terminal and submit the deploy command and it worked fine.
The code lab gets you to do this and then leave it served locally while changing various parts of the app, but I have no idea what caused winston to conflict this way.
This probably an issue with NPM try running npm cache clean and reinstall firebase tools. If that didn't work try contacting firebase support. Recently I ran into an issue with firebase hosting and they were really helpful but took about 30 hours for their response after making the support ticket.
I had the exact same error, I tried restarting Command Prompt, deleting the cache file in the .firebase project folder. deploy worked fine with a separate test project.
On a whim I shut down my local server, and firebase deploy worked fine. Not sure if that's the real fix, as I'm 99.9% sure I did deploys in the past with the local server running... but it works for me now.
And after deploy was working again, it stopped a second time with the same error. So I stopped the server, and once again deploy worked. Then if failed a third time, same fix, shut down the local server.
Local server was run via firebase serve --only hosting
npm cache verify also checked out A-OK:
https://docs.npmjs.com/cli-commands/cache.html

Strange ECONNRESET error I cannot figure out

I do not know, if this is related to koa, or is problem of some other npm module or something else. I am going to start from here.
So to the problem. I am having REST api written in koa v1. We are running node server in the Docker image. One of the endpoints we have, starts the import and returns the status 200 with message: "import started", and when the import finishes, we send Slack message to notify us.
So first I tested the server on my local machine, everything works (endpoint does not throw any errors). Then I built docker image. I run container localy, everything works (endpoint does not throw any errors). I deploy my image to Mesos environment, everything works so far. Container runs, every endpoint works, beside import endpoint. When I call it, after few seconds (5 to 10), I get ECONNRESET error, the running container gets killed and new running instance is started. So import is terminated.
At the beginning we assigned 128 MB ram to the docker container and that seems to be enough. After import error occurred, we thought maybe OOM killed process. So we decided to check dmesg and we could not find any log entries related to the OOM and the process of the running container. Then we checked ram usage of the container locally (with htop) and found out it uses aprox. 250+ MB, so we decided to add more ram in marathon config (512 MB). That however did not help, same error occurred.
Because the error was not explicit enough we installed longjohn module, so we could get more detailed error message. That got us just a little bit more information, but not as much as we thought it would.
Error: read ECONNRESET
at exports._errnoException (util.js:1026:11)
at TCP.onread (net.js:569:26)
---------------------------------------------
at Application.app.callback (/src/node_modules/koa/lib/application.js:130:45)
at Application.app.listen (/src/node_modules/koa/lib/application.js:73:39)
at Promise.then.result (/src/server.js:97:13)
Error: read ECONNRESET
at exports._errnoException (util.js:1026:11)
at TCP.onread (net.js:569:26)
Line 97 of the server.js is:
96:if(!module.parent) {
97: app.listen(port, (err) => {
98: if (err) {
99: console.error('Server error', err);
100: }
101: console.log('Listening on the port', port);
102: });
103:}
So what exactly happens in the endpoint logic. We are using postgres npm module pg. We are passing pg.Pool to the context, so later we can use it in our models. We are executing insert query encapsulated in promise and push promises in the array. There are roughly 2700+ records. Later we do Promise.all on the array of promises and with then we send the message to Slack.
As you can see I do not know if the error is related to koa or pg or some other thing. What is more intriguing is that locally everything works (node server as well as in docker container), but on Mesos it does not. How can I find out what is wrong?
version of koa npm module: 1.2.0
version of pg npm module: 6.1.0
version of Postgres 9.5
version of Mesos: 1.0.1
According to this github issue this is an error caused by tiny-lr.
It seems that downgrading to version 0.2.1 stops it, but this is usually a dependency of other packages you're using that you've got no control over. You might be able to filter out the error by displaying all errors except this, as such:
if (error.code !== 'ECONNRESET') { console.log(error) }
The issue is still open, and dates from Oct 27, 2016. Don't know if it will get fixed or not. But as far as feedback goes, it doesn't seem like a dangerous error, or to have any impact whatsoever. But heh, I'd rather fix mine too, if there was a way.
Thanks to another developer, we found out what was the cause of the ERROR. We used all connections in the pool when there was an import running.
When the marathon was requesting the service status at the time of the import, service tried to connect to the database to test the connection and at that time the connection to the database was terminated. Service became unhealthy and marathon restarted the service. We re-factored the import code. We are limiting the number of pool connections.

Node.js – events js 72 throw er unhandled 'error' event

I'm new to Node.js and wish to run a program using streams. With other programs, I had to start a server simultaneously (mongodb, redis, etc) but I have no idea if I'm supposed to run one with this. Please let me know where I am going wrong and how I can rectify this.
This is the program:
var http = require('http'),
feed = 'http://isaacs.iriscouch.com/registry/_changes?feed=continuous';
function decide(cb) {
setTimeout(function () {
if (Date.now()%2) { return console.log('rejected'); }
cb();
}, 2000);
}
http.get(feed, function (res) {
decide(res.pipe.bind(res, process.stdout));
//using anonymous function instead of bind:
// decide(function () {
// res.pipe(process.stdout)
// });
});
This is the cmd output:
<b>C:\05-Employing Streams\05-Employing Streams\23-Playing with pipes>node npm_stre
am_piper.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: Parse Error
at Socket.socketOnData (http.js:1583:20)
at TCP.onread (net.js:527:27)
</b>
Close nodejs app running in another shell.
Restart the terminal and run the program again.
Another server might be also using the same port that you have used for nodejs. Kill the process that is using nodejs port and run the app.
To find the PID of the application that is using port:8000
$ fuser 8000/tcp
8000/tcp: 16708
Here PID is 16708 Now kill the process using the kill [PID] command
$ kill 16708
I had the same problem. I closed terminal and restarted node. This worked for me.
Well, your script throws an error and you just need to catch it (and/or prevent it from happening). I had the same error, for me it was an already used port (EADDRINUSE).
I always do the following whenever I get such error:
// remove node_modules/
rm -rf node_modules/
// install node_modules/ again
npm install // or, yarn
and then start the project
npm start //or, yarn start
It works fine after re-installing node_modules. But I don't know if it's good practice.
Check your terminal it happen only when you have your application running on another terminal..
The port is already listening..
For what is worth, I got this error doing a clean install of nodejs and npm packages of my current linux-distribution
I've installed meteor using
npm install metor
And got the above referenced error. After wasting some time, I found out I should have used meteor's way to update itself:
meteor update
This command output, among others, the message that meteor was severely outdated (over 2 years) and that it was going to install itself using:
curl https://install.meteor.com/ | sh
Which was probably the command I should have run in the first place.
So the solution might be to upgrade/update whatever nodejs package(js) you're using.

Meteor 0.7 error

I need help.
After upgrading meteor to 0.7 version, application can not start with strange error (but, before update and if i create a new app - it worked well):
ant#ant-VirtualBox:~/testtracker$ mrt
Stand back while Meteorite does its thing
Done installing smart packages
Ok, everything's ready. Here comes Meteor!
[[[[[ ~/testtracker ]]]]]
/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/fibers/future.js:173
throw(ex);
^
TypeError: Cannot call method 'split' of undefined
at parseStack (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:257:26)
at Object.exception (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:399:17)
at /home/ant/.meteor/tools/ec9f953f89/tools/packages.js:448:22
at Array.forEach (native)
at Function._.each._.forEach (/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/underscore/underscore.js:79:11)
at _.extend.build (/home/ant/.meteor/tools/ec9f953f89/tools/packages.js:235:7)
at /home/ant/.meteor/tools/ec9f953f89/tools/packages.js:1041:13
at Array.forEach (native)
at Function._.each._.forEach (/home/ant/.meteor/tools/ec9f953f89/lib/node_modules/underscore/underscore.js:79:11)
at _.extend.build (/home/ant/.meteor/tools/ec9f953f89/tools/packages.js:1040:7)
at _.extend.getForApp (/home/ant/.meteor/tools/ec9f953f89/tools/library.js:285:9)
at /home/ant/.meteor/tools/ec9f953f89/tools/bundler.js:1646:25
at Object.capture (/home/ant/.meteor/tools/ec9f953f89/tools/buildmessage.js:175:5)
at Object.exports.bundle (/home/ant/.meteor/tools/ec9f953f89/tools/bundler.js:1580:31)
at /home/ant/.meteor/tools/ec9f953f89/tools/run.js:532:32
at /home/ant/.meteor/tools/ec9f953f89/tools/fiber-helpers.js:24:12
Please, give me advice, what i can do with this.
I think you need to update mrt packages as well.
mrt update
Do you use the mongodb instance from meteor or do you use an external mongodb instance (used by MONGO_URL env) ?
I got the same problem because it seems that mongolab doesn't accept the new oplog system from meteor.
Finally i now use the internal mongodb instance because i didn't find another solution from mongolab.

node: has no method create

I'm trying to test out a node/backbone tutorial at this git hub site $ git clone git://github.com/antoviaque/backbone-relational-tutorial.git. When I start the node server (by running command node app), I'm getting an error that a method create doesn't exist in a restify module. The error's triggered right after the server appears to start
restify listening at http://0.0.0.0:3001
I'm not at all experienced with node, and would appreciate any help you can offer.
node_modules/restify/lib/server.js:724
d = domain.create();
Object function Domain(options){
...lots of code ommitted....
has no method 'create'
at Server._run (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:724:20)
at onRoute (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:592:38)
at Router.find (/Users/mm/Sites/backboneforum/node_modules/restify/lib/router.js:372:17)
at _route (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:532:29)
at Server._handle (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:617:17)
at Server.onRequest (/Users/mm/Sites/backboneforum/node_modules/restify/lib/server.js:201:22)
at Server.emit (events.js:70:17)
at HTTPParser.onIncoming (http.js:1514:12)
at HTTPParser.onHeadersComplete (http.js:102:31)
at Socket.ondata (http.js:1410:22)
To put the comments into an answer:
It does not work, because the domain module was introduced as part of Node.js 0.8. As you are running 0.6, it can not be found. Hence you get an appropriate error message.
As you have said, your package.json says:
"node": ">= 0.6.0 < 0.7.0"
Try adjusting this setting to a value that also accepts Node.js 0.8 (or even 0.10), or - which may be the better solution - get rid of this line completely. If you do not use any things specific to Node.js 0.6, everything should still work.
Hope this helps.

Resources