Deprecation Warning - Current Server Discovery and Monitoring engine is deprecated

I’m seeing this warning only in production:

DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-deprecation ...` to show where the warning was created)

I’m running Meteor 2.3.4. My understaning is that useUnifiedTopology was set to true by default in v2.2 Meteor Changelog | Meteor API Docs.

I also tried to set it in Meteor.settings:

 "packages": {
    "mongo": {
      "options": {
        "useUnifiedTopology": true
      }
    }
  }

I’m building with this Dockerfile:

# The tag here should match the Meteor version of your app, per .meteor/release
FROM geoffreybooth/meteor-base:2.3.4

# Copy app package.json and package-lock.json into container
COPY ./package*.json $APP_SOURCE_FOLDER/

RUN bash $SCRIPTS_FOLDER/build-app-npm-dependencies.sh

# Copy app source into container
COPY . $APP_SOURCE_FOLDER/

RUN bash $SCRIPTS_FOLDER/build-meteor-bundle.sh


# Use the specific version of Node expected by your Meteor release, per https://docs.meteor.com/changelog.html
FROM node:14.17.4-alpine

ENV APP_BUNDLE_FOLDER /opt/bundle
ENV SCRIPTS_FOLDER /docker

# Install OS build dependencies, which we remove later after we’ve compiled native Node extensions
RUN apk --no-cache --virtual .node-gyp-compilation-dependencies add \
    g++ \
    make \
    python \
  # And runtime dependencies, which we keep
  && apk --no-cache add \
    bash \
    ca-certificates

# Copy in entrypoint
COPY --from=0 $SCRIPTS_FOLDER $SCRIPTS_FOLDER/

# Copy in app bundle
COPY --from=0 $APP_BUNDLE_FOLDER/bundle $APP_BUNDLE_FOLDER/bundle/

RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh --build-from-source \
  && apk del .node-gyp-compilation-dependencies

# Start app
ENTRYPOINT ["/docker/entrypoint.sh"]

CMD ["node", "main.js"]

Any ideas on how to resolve?

1 Like

Hi, yes, as you can see in the code here we are always using useUnifiedTopology: true in the latest versions of Meteor.

The version of Meteor in your Dockerfile doesn’t matter, the important part is the Meteor version in your project.

You can check the version of your project in your .meteor/release file or running meteor --version.

Or maybe you are using a different way to connect to Mongo instead of Meteor Collections.