I have done enketo-express installtion while launching enkto it shows below error. I'm using this command to launch enketo "npm start"
AbortError: Ready check failed: Redis connection lost and command aborted. It might have been processed.
at RedisClient.flush_and_error (enketo-express/node_modules/redis/index.js:362:23)
at RedisClient.connection_gone (enketo-express/node_modules/redis/index.js:664:14)
at Socket. (enketo-express/node_modules/redis/index.js:293:14)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Worker 7873 sadly passed away. It will be reincarnated.
Note: Following this doc step no: 7
check netstat -ntlp
which port is using 8005
or in some case something running on port 6380
"cache": {
"host": "127.0.0.1",
"port": "6379", # change port from 6380
"password": null
}
Also Different Node version too causes similar problems. Use node version as described in readme
https://github.com/kobotoolbox/enketo-express/issues/528
Related
I'm just starting with Node.js and I'm following this tutorial https://dev.to/glaucia86/developing-a-crud-node-js-application-with-postgresql-4c9o
when setting .env file as suggested
DATABASE_URL=postgres://{db_username}:{db_password}#{host}:{port}/{db_name}
so
DATABASE_URL=postgres://vinnytwice:pass#localhost:5432/fixit
I start the server with npm start command when using Postman to send a Post request I get they error in console:
vinnytwice#Vinnys-iMac fixit_server_node % npm start
> fixit_server_node#1.0.0 start
> node server.js
App executing to port 3000
error: database "vinnytwice" does not exist
at Parser.parseErrorMessage (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/parser.js:287:98)
at Parser.handlePacket (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/Volumes/ProjectsSSD/FixitServer/fixit_server_node/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:369:20)
at addChunk (node:internal/streams/readable:313:12)
at readableAddChunk (node:internal/streams/readable:288:9)
at Socket.Readable.push (node:internal/streams/readable:227:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
What am I doing wrong ?
Many thanks.
Finally found the problem, the .env file wasn't at the root of the project.
I am following the tutorial Using Google OAUTH2.0 with a REST server (https://hyperledger.github.io/composer/latest/tutorials/google_oauth2_rest). After login with success into my Google account, I get this error on the browser:
{
"error": {
"statusCode": 500,
"name": "InternalOAuthError",
"message": "Failed to obtain access token",
"oauthError": {
"errno": "ENOTFOUND",
"code": "ENOTFOUND",
"syscall": "getaddrinfo",
"hostname": "accounts.google.com",
"host": "accounts.google.com",
"port": 443
},
"stack": "InternalOAuthError: Failed to obtain access token\n at Strategy.OAuth2Strategy._createOAuthError (/home/composer/node_modules/passport-oauth2/lib/strategy.js:379:17)\n at /home/composer/node_modules/passport-oauth2/lib/strategy.js:166:45\n at /home/composer/node_modules/oauth/lib/oauth2.js:191:18\n at ClientRequest.<anonymous> (/home/composer/node_modules/oauth/lib/oauth2.js:162:5)\n at emitOne (events.js:116:13)\n at ClientRequest.emit (events.js:211:7)\n at TLSSocket.socketErrorListener (_http_client.js:387:9)\n at emitOne (events.js:116:13)\n at TLSSocket.emit (events.js:211:7)\n at emitErrorNT (internal/streams/destroy.js:66:8)\n at args.(anonymous function) (/home/composer/.npm-global/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)\n at _combinedTickCallback (internal/process/next_tick.js:139:11)\n at process._tickDomainCallback (internal/process/next_tick.js:219:9)"
}
}
I am behind a corporate proxy. So, I suspect there it is the problem but I am not sure.
Following the tutorial instructions, I edited the file Dockerfile for adding npm configuration of the proxy (ip and port with the right data):
FROM hyperledger/composer-rest-server
RUN npm config set proxy http://ip:port && npm config set https-proxy http://ip:port && \
npm install --production loopback-connector-mongodb passport-google-oauth2 request https-proxy-agent && \
npm cache clean --force && \
ln -s node_modules .node_modules
Also, and I added request and https-proxy-agent modules for implementing the workaround explaining here: Use Passport.js Behind Corporate Firewall for Facebook Strategy, but with no success.
I built the Docker image composer-rest-server like this:
docker build -t myorg/composer-rest-server --build-arg http_proxy=http://ip:port --build-arg https_proxy=http://ip:port .
When I ran the Docker container, this was the log:
[2018-09-28T10:48:18.240Z] PM2 log: Launching in no daemon mode
[2018-09-28T10:48:18.318Z] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-09-28T10:48:18.325Z] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...
(node:15) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
Discovering the Returning Transactions..
Discovered types from business network definition
Generating schemas for all types in business network definition ...
Generated schemas for all types in business network definition
Adding schemas for all types to Loopback ...
Added schemas for all types to Loopback
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
And, after login to my Google account, this was the log:
Unhandled error for request GET /auth/google/callback?code=4%2FbAC3w3UnnALN4kKQD8RdjfC_wrXJeFAojIHKOANISGWYn-zvIzTeO24P96T_SaJDhVBPcbdqrmLxUyv9IajeYrg&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.me+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.profile.agerange.read+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fplus.profile.language.read+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile: InternalOAuthError: Failed to obtain access token
at Strategy.OAuth2Strategy._createOAuthError (/home/composer/node_modules/passport-oauth2/lib/strategy.js:379:17)
at /home/composer/node_modules/passport-oauth2/lib/strategy.js:166:45
at /home/composer/node_modules/oauth/lib/oauth2.js:191:18
at ClientRequest. (/home/composer/node_modules/oauth/lib/oauth2.js:162:5)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:66:8)
at args.(anonymous function) (/home/composer/.npm-global/lib/node_modules/pm2/node_modules/event-loop-inspector/index.js:138:29)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickDomainCallback (internal/process/next_tick.js:219:9)
And this is COMPOSER_PROVIDERS variable, with the right clientID and clientSecret values:
COMPOSER_PROVIDERS='{
"google": {
"provider": "google",
"module": "passport-google-oauth2",
"clientID": "REPLACE_WITH_CLIENT_ID",
"clientSecret": "REPLACE_WITH_CLIENT_SECRET",
"authPath": "/auth/google",
"callbackURL": "/auth/google/callback",
"scope": "https://www.googleapis.com/auth/plus.login",
"successRedirect": "/",
"failureRedirect": "/"
}
Anyone could tell me where is the problem?
Thanks.
PD: Sorry for this brick!
I'm pretty sure I've exhausted all methods here, followed the first 3 pages of Google and near every similar question here, and I am getting sick of reading every response to this "have you downloaded MongoDB?".
YES, it is downloaded, and running, and connectable from Robo3T and CLI mongo.
MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 4.0.2
YES, it was downloaded/installed using the recommended setup from source -- ie, home brew, brew services etc.
Jamies-MacBook-Pro:api jamiepoole$ brew services list
Name Status User Plist
mongodb started jamiepoole /Users/jamiepoole/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
YES, I have tried connecting with localhost, 127.0.0.1, hell even the computer hostname / Jamies-MacBook-Pro.local
I have no doubt I'm doing something stupid or missed something simple, but I am pretty certain its not that.
const Database = Mongoose.connect('mongodb://localhost:27071/myproject');
---
I replaced project details from the below with ... -- so this isn't a setting / in the code.
{ MongoNetworkError: failed to connect to server [localhost:27071] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27071]
at Pool.<anonymous> (/Users/.../node_modules/mongodb-core/lib/topologies/server.js:564:11)
at emitOne (events.js:116:13)
at Pool.emit (events.js:211:7)
at Connection.<anonymous> (/Users/.../node_modules/mongodb-core/lib/connection/pool.js:317:12)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at Connection.emit (events.js:214:7)
at Socket.<anonymous> (/Users/.../node_modules/mongodb-core/lib/connection/connection.js:246:50)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoNetworkError',
errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {} }
---
At this point any help at all would be amazing. Seems like such a simple error but can't find any help anywhere.
Cheers
You have defined wrong MongoDB port in your code while your CLI is connecting to the right port which 27017. You can edit the code as follows
const Database = Mongoose.connect('mongodb://localhost:27017/myproject');
I have a Dedicated windows server, I am running my node express code on the server, but when an exception occurred like
error: remaining connection slots are reserved for non-replication superuser connections
at Connection.parseE (C:\node\zykrrapi\prod\myapp\node_modules\pg\lib\connection.js:554:11)
at Connection.parseMessage (C:\node\zykrrapi\prod\myapp\node_modules\pg\lib\connection.js:381:17)
at TLSSocket.<anonymous> (C:\node\zykrrapi\prod\myapp\node_modules\pg\lib\connection.js:117:22)
at TLSSocket.emit (events.js:180:13)
at addChunk (_stream_readable.js:269:12)
at readableAddChunk (_stream_readable.js:256:11)
at TLSSocket.Readable.push (_stream_readable.js:213:10)
at TLSWrap.onread (net.js:578:20)
Emitted 'error' event at:
at Connection.<anonymous> (C:\node\zykrrapi\prod\myapp\node_modules\pg\lib\client.js:183:19)
at Connection.emit (events.js:180:13)
at TLSSocket.<anonymous> (C:\node\zykrrapi\prod\myapp\node_modules\pg\lib\connection.js:121:12)
at TLSSocket.emit (events.js:180:13)
[... lines matching original stack trace ...]
at TLSWrap.onread (net.js:578:20)
and another error like "too many connections to the user on database" error also occurs and stops the execution of the code. this makes a huge loss of the data for me.
I want to run the Node Js Code continuously and to start the execution again if it stopped unexpectedly.
I am running the code using command "npm start" in windows server...
I want this node code to run only on the windows dedicated server.
I am having this problem while connecting the elasticsearch connections.
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({ host: 'localhost:9200',
log: 'trace'});
Elasticsearch ERROR: 2016-07-19T19:09:26Z
Error: Request error, retrying -- connect ECONNREFUSED 127.0.0.1:9200
at Log.error (/root/git_build/FirstMoveChess/node_modules/elasticsearch/src/lib/log.js:225:56)
at checkRespForFailure (/root/git_build/FirstMoveChess/node_modules/elasticsearch/src/lib/transport.js:195:18)
at HttpConnector. (/root/git_build/FirstMoveChess/node_modules/elasticsearch/src/lib/connectors/http.js:154:7)
at ClientRequest.bound (/root/git_build/FirstMoveChess/node_modules/lodash-node/modern/internals/baseBind.js:56:17)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:308:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1272:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Elasticsearch TRACE: 2016-07-19T19:09:27Z
-> HEAD http://localhost:9200/
I understand this question is quite old but I wanted to share how you can solve this problem.
If you are locally using elasticsearch
First thing you must do is running elasticsearch on your machine.
Error: Request error, retrying -- connect ECONNREFUSED 127.0.0.1:9200
Because above message indicates that you're not running elasticsearch locally.
So, visit the link and follow the insturction.
Docker environment
It gets much trickier here.
First, follow the instruction here.
And in case you're using node.js elasticsearch client, you have to specify elasticsearch host as 172.24.0.1.
If you use container_name or private IP of container in docker-compose.yml, it won't work.
In case of Docker Container Environment after changing from http://localhost:9200 to http://ipaddress:9200 in docker-compose.yml
please change the following live in docker-compose.yml that is related to CORS
Change this
** http.cors.allow-origin=/https?://localhost(:[0-9]+)?/ **
into this
*- http.cors.allow-origin= **