Parse Server and mongodb issue

假如想象 提交于 2020-06-27 10:30:09

问题


I'm trying to setup a local install of a parse server for my express app. Here is what I have done:

npm install -g parse-server mongodb-runner

Then:

mongodb-runner start

That triggered this error:

  Starting a MongoDB deployment to test against...{ HTTPError: Response code 403 (Forbidden)
at EventEmitter.ee.on.res (/usr/local/lib/node_modules/mongodb-runner/node_modules/got/index.js:250:24)
at EventEmitter.emit (events.js:182:13)
at Immediate.setImmediate (/usr/local/lib/node_modules/mongodb-runner/node_modules/got/index.js:99:8)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
name: 'HTTPError',
host: 'fastdl.mongodb.org',
hostname: 'fastdl.mongodb.org',
method: 'GET',
path: '/osx/mongodb-macos-x86_64-4.0.3.tgz',
protocol: 'https:',
url:
'https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.0.3.tgz',
statusCode: 403,
statusMessage: 'Forbidden',
headers:
{ 'content-type': 'application/xml',
 'transfer-encoding': 'chunked',
 connection: 'close',
 date: 'Wed, 17 Oct 2018 18:38:43 GMT',
 server: 'AmazonS3',
 'x-cache': 'Error from cloudfront',
 via:
  '1.1 c743f1ce1ce65e454843328ae4e050a2.cloudfront.net (CloudFront)',
 'x-amz-cf-id': 'eA7O6955PJVLdcvfXCAuTW3YOEGRoGcWGxGXRgAiPq8zbGFyBvug8Q==' } }

So instead of running mongodb locally I decided to create a cluster on mongodb.com. Then I tried running this command connecting to the cluster(of course I replaced the APP_ID, MASTER_KEY, and MONGODB_DATABASE_URI with the proper values):

parse-server --appId APP_ID --masterKey MASTER_KEY --databaseURI MONGODB_DATABASE_URI

this is the error I got:

/usr/local/lib/node_modules/parse-server/lib/ParseServer.js:225
      throw err;
      ^

TypeError: Cannot read property 'close' of undefined
at topology.connect (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/lib/operations/mongo_client_ops.js:412:16)
at ReplSet.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/lib/topologies/replset.js:364:11)
at Object.onceWrapper (events.js:273:13)
at ReplSet.emit (events.js:182:13)
at ReplSet.EventEmitter.emit (domain.js:442:20)
at /usr/local/lib/node_modules/parse-server/node_modules/mongodb-core/lib/topologies/replset.js:631:23
at Server.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb-core/lib/topologies/replset.js:357:9)
at Object.onceWrapper (events.js:273:13)
at Server.emit (events.js:182:13)
at Server.EventEmitter.emit (domain.js:442:20)

I've been googling for so long and I can't figure this out. parse-server and mongodb are both completely up to date. Says parse-server is 3.0.0 and mongodb is 3.1.8


回答1:


It looks like mongodb-runner downloads some files from mongodb.org the first time and, according to this thread, those links have changed for some versions. So try different mongo versions by setting then environmental var MONGODB_VERSION when running mongodb-runner:

MONGODB_VERSION=3.4.1 mongodb-runner


来源:https://stackoverflow.com/questions/52861652/parse-server-and-mongodb-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!