如何验证从gitlab ci / cd到mlab的mongodb连接

时间:2019-05-23 18:14:55

标签: node.js mongodb mongoose gitlab-ci

我无法从gitlab ci / cd连接到mlab(mongodb在线服务),但可以轻松地从本地连接到mlab。 两种情况下我都使用相同的配置,但是为什么本地和gitlab不同?我在这里很困惑

此外,这是我第一次尝试集成ci / cd,因此我陷入各种愚蠢的问题是很正常的事,但是我被困了两天而又不知道是什么问题。

我尝试使用此https://github.com/Automattic/mongoose/issues/6332以及此链接-> https://github.com/Automattic/mongoose/issues/4587

的解决方案

但是问题没有解决。

在这里我记下了gitlab yml文件,请看一下,如果我在这里错过了任何内容。

cache:
    paths:
    - node_modules/
    - src/client/node_modules/

stages:
- deploy

install_dependencies:
    stage: deploy
    script: 
        - npm install
        - npm run installClientDependencies
        - npm run devRemoteServer
        - echo $NODE_ENV
    only: 
        - master

这是gitlab作业日志所说的(错误)

(node:165) UnhandledPromiseRejectionWarning: MongoError: Authentication failed.
    at _authenticateSingleConnection (/builds/a.f.fariv/myblog/node_modules/mongodb-core/lib/auth/auth_provider.js:46:25)
    at sendAuthCommand (/builds/a.f.fariv/myblog/node_modules/mongodb-core/lib/auth/scram.js:214:18)
    at Connection.messageHandler (/builds/a.f.fariv/myblog/node_modules/mongodb-core/lib/connection/connect.js:334:5)
    at Connection.emit (events.js:189:13)
    at processMessage (/builds/a.f.fariv/myblog/node_modules/mongodb-core/lib/connection/connection.js:364:10)
    at Socket.<anonymous> (/builds/a.f.fariv/myblog/node_modules/mongodb-core/lib/connection/connection.js:533:15)
    at Socket.emit (events.js:189:13)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at Socket.Readable.push (_stream_readable.js:220:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
(node:165) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:165) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

0 个答案:

没有答案