i'm trying to execute the commande "slc run" to access to API loopback but ther's a problem with mongodb even if i run mongod it display this error :
MongoError: Authentication failed.
at Function.MongoError.create (C:\Users\abdessamad\ingeweb_workspace\roll-lo
opback\node_modules\mongodb-core\lib\error.js:31:11)
at C:\Users\abdessamad\ingeweb_workspace\roll-loopback\node_modules\mongodb-
core\lib\connection\pool.js:483:72
at authenticateStragglers (C:\Users\abdessamad\ingeweb_workspace\roll-loopba
ck\node_modules\mongodb-core\lib\connection\pool.js:429:16)
at Connection.messageHandler (C:\Users\abdessamad\ingeweb_workspace\roll-loo
pback\node_modules\mongodb-core\lib\connection\pool.js:463:5)
at Socket.<anonymous> (C:\Users\abdessamad\ingeweb_workspace\roll-loopback\n
ode_modules\mongodb-core\lib\connection\connection.js:319:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:189:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:551:20)
Related
I am trying to connect my nodejs with mongoDB but it is not working fine as the following result below.
**
(node:11776) DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your o
wn promise library instead: http://mongoosejs.com/docs/promises.html
{ MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0
.1:27017]
at Pool.<anonymous> (D:\KIT\YEAR II\Project\Nodejs\Vidjot\node_modules\mongodb-core\lib\topologies\server.js:336:3
5)
at emitOne (events.js:116:13)
at Pool.emit (events.js:211:7)
at Connection.<anonymous> (D:\KIT\YEAR II\Project\Nodejs\Vidjot\node_modules\mongodb-core\lib\connection\pool.js:2
80:12)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at Connection.emit (events.js:214:7)
at Socket.<anonymous> (D:\KIT\YEAR II\Project\Nodejs\Vidjot\node_modules\mongodb-core\lib\connection\connection.js
:187:49)
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: 'MongoError',
message: 'failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1
:27017]' }
**
Here is my source code
Make sure your mongo server is running # localhost:27017 and you have directories created to store data.
start using this command:
>mongod --port 27017 --dbpath c:\data\db
I am trying to connect to Mongolab through the Expressjs. But when I run ,I am getting failed to connect to the server
Error Message :
MongoError: failed to connect to server [ds033066.mlab.com:33066] on first con
nect [MongoError: connect ETIMEDOUT 54.80.215.206:33066]
at Pool.<anonymous> (C:\Users\rkishore\Documents\node\node_modules\mongoose\
node_modules\mongodb-core\lib\topologies\server.js:328:35)
at emitOne (events.js:96:13)
at Pool.emit (events.js:188:7)
at Connection.<anonymous> (C:\Users\rkishore\Documents\node\node_modules\mon
goose\node_modules\mongodb-core\lib\connection\pool.js:280:12)
at Connection.g (events.js:292:16)
at emitTwo (events.js:106:13)
at Connection.emit (events.js:191:7)
at Socket.<anonymous> (C:\Users\rkishore\Documents\node\node_modules\mongoos
e\node_modules\mongodb-core\lib\connection\connection.js:177:49)
at Socket.g (events.js:292:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1277:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
name: 'MongoError',
message: 'failed to connect to server [ds033066.mlab.com:33066] on first conne
ct [MongoError: connect ETIMEDOUT 54.80.215.206:33066]'
Any Help/Suggestion greatly appreciated.
Running a simple http request in nodejs for web crawling purposes.
Unfortunately, one website we're trying to crawl is configured such that it has the Content-Length header twice.
This is throwing an error on nodejs:
Error: Parse Error
at Error (native)
at Socket.socketOnData (_http_client.js:363:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:548:20) bytesParsed: 239, code:'HPE_UNEXPECTED_CONTENT_LENGTH' },
isOperational: true,
bytesParsed: 239,
code: 'HPE_UNEXPECTED_CONTENT_LENGTH'
I'm trying to find a workaround that doesn't involve downgrading my nodejs server... Any ideas?
Wanted to test Twitter OAuth callback with my React app on localhost.
Saw that you could use http://127.0.0.1:8000 in the Twitter App Console for both Website and Callback URL fields for it to work with localhost.
const twitterStream = new Twitter(twitterConfig.TWITTER_CONFIG);
I am using the twitter npm and getting the following 401 status code error --
Error: Status Code: 401
at Request.<anonymous> (/Users/me/Projects/project-name/node_modules/twitter/lib/twitter.js:277:28)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.onRequestResponse (/Users/me/Projects/pproject-name/node_modules/request/request.js:986:10)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:474:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
at TLSSocket.socketOnData (_http_client.js:363:20)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at TLSSocket.Readable.push (_stream_readable.js:134:10)
at TLSWrap.onread (net.js:548:20)
Appreciate the help.
You need to set http://127.0.0.1:8000/auth/twitter/callback as the callback URL in application settings back on Twitter.
I was running a nodejs api as a pod on a google compute engine managed by kubernetes. The API was connecting to database well but then it failed suddenly showing this error:
listening to http server on 0.0.0.0:8080...
events.js:160
throw er; // Unhandled 'error' event
^
MongoError: failed to connect to server [mongo:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo mongo:27017]
at Pool.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/topologies/server.js:328:35)
at emitOne (events.js:96:13)
at Pool.emit (events.js:188:7)
at Connection.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:274:12)
at Connection.g (events.js:292:16)
at emitTwo (events.js:106:13)
at Connection.emit (events.js:191:7)
at Socket.<anonymous> (/usr/src/app/node_modules/mongodb-core/lib/connection/connection.js:177:49)
at Socket.g (events.js:292:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at connectErrorNT (net.js:1021:8)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
I tried to restart the prods, to delete and re-create containers but no success?
this is how I connect to database:
mongoose.connect(process.env.MONGO_DEV_URL || process.env.MONGODB_URI || 'mongodb://mongo:27017:yaxiDb/yaxiDb', { useMongoClient: true });
How can I debug this, where could be the problem?
I just found the solution, the order of creating services matters. I've deleted all services that use that database and re-create them:
kubectl delete -f containers/backend/
kubectl create -f containers/backend/