strapi / strapi-docker

Install and run your first Strapi project using Docker
https://strapi.io
MIT License
1.17k stars 446 forks source link

getting mongo error during database initialisation #128

Closed tspycher closed 5 years ago

tspycher commented 5 years ago

This is the output from the docker image which i'm using on my Kubernetes Cluster with mongo atlas:

🚀 Starting to create your Strapi application.

Database determined by CLI args: mongo

⏳ Testing database connection...
It might take a minute, please have a coffee ☕️

The app has been connected to the database successfully!

🏗  Application generation:

👌 Your new application name is ready at /usr/src/api/name.

⚡️ Change directory:
$ cd name

⚡️ Start application:
$ strapi start
(node:512) UnhandledPromiseRejectionWarning: MongoError: w has to be a number or a string
    at Connection.<anonymous> (/usr/src/api/name/node_modules/mongodb-core/lib/connection/pool.js:443:61)
    at Connection.emit (events.js:182:13)
    at Connection.EventEmitter.emit (domain.js:441:20)
    at processMessage (/usr/src/api/name/node_modules/mongodb-core/lib/connection/connection.js:364:10)
    at TLSSocket.<anonymous> (/usr/src/api/name/node_modules/mongodb-core/lib/connection/connection.js:533:15)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at TLSSocket.Readable.push (_stream_readable.js:219:10)
    at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:122:17)
(node:512) 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:512) [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.
(node:512) UnhandledPromiseRejectionWarning: MongoError: w has to be a number or a string
    at Connection.<anonymous> (/usr/src/api/name/node_modules/mongodb-core/lib/connection/pool.js:443:61)
    at Connection.emit (events.js:182:13)
    at Connection.EventEmitter.emit (domain.js:441:20)
    at processMessage (/usr/src/api/name/node_modules/mongodb-core/lib/connection/connection.js:364:10)
    at TLSSocket.<anonymous> (/usr/src/api/name/node_modules/mongodb-core/lib/connection/connection.js:533:15)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at TLSSocket.Readable.push (_stream_readable.js:219:10)
    at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:122:17)
(node:512) 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: 2)
(node:512) UnhandledPromiseRejectionWarning: ReferenceError: config is not defined
    at fs.readdir (/usr/src/api/name/plugins/upload/config/functions/bootstrap.js:70:40)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
(node:512) 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: 3)
(node:512) UnhandledPromiseRejectionWarning: ReferenceError: config is not defined
    at fs.readdir (/usr/src/api/name/plugins/email/config/functions/bootstrap.js:68:40)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
(node:512) 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: 4)
(node:512) UnhandledPromiseRejectionWarning: MongoError: w has to be a number or a string
    at Connection.<anonymous> (/usr/src/api/name/node_modules/mongodb-core/lib/connection/pool.js:443:61)
    at Connection.emit (events.js:182:13)
    at Connection.EventEmitter.emit (domain.js:441:20)
    at processMessage (/usr/src/api/name/node_modules/mongodb-core/lib/connection/connection.js:364:10)
    at TLSSocket.<anonymous> (/usr/src/api/name/node_modules/mongodb-core/lib/connection/connection.js:533:15)
    at TLSSocket.emit (events.js:182:13)
    at TLSSocket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at TLSSocket.Readable.push (_stream_readable.js:219:10)
    at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:122:17)
(node:512) 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: 5)
[2019-07-25T08:07:03.297Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2019-07-25T08:07:03.298Z] warn Perhaps you forgot to call it?
[2019-07-25T08:07:03.298Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2019-07-25T08:07:03.298Z] warn Perhaps you forgot to call it?
[2019-07-25T08:07:03.298Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2019-07-25T08:07:03.298Z] warn Perhaps you forgot to call it?
[2019-07-25T08:07:03.300Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2019-07-25T08:07:03.300Z] warn Perhaps you forgot to call it?

My container configuration looks like this:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: strapi
  labels:
    app: strapi
spec:
  replicas: 1
  selector:
    matchLabels:
      app: strapi
  template:
    metadata:
      labels:
        app: strapi
    spec:
      containers:
      - name: strapi
        image: strapi/strapi
        ports:
        - containerPort: 1337
        env:
        - name: APP_NAME
          value: name
        - name: DATABASE_CLIENT
          value: mongo
        - name: DATABASE_HOST
          value: "name-shard-00-00-zl4gc.mongodb.net:27017,name-shard-00-01-zl4gc.mongodb.net:27017,name-shard-00-02-zl4gc.mongodb.net:27017/strapi?ssl=true&replicaSet=name-shard-0&authSource=admin&retryWrites=true&w=majority"
        - name: DATABASE_NAME
          value: strapi
        - name: DATABASE_USERNAME
          value: username
        - name: DATABASE_PASSWORD
          value: password
        - name: DATABASE_SSL
          value: "true"
        - name: DATABASE_AUTHENTICATION_DATABASE
          value: admin
tspycher commented 5 years ago

i had to remove &w=majority at the end of the DATABASE_HOST environment variable