Accessing MongoDB hosted on DigitalOcean with Next.js Web App

Posted January 5, 2022 98 views

I am using Mongo URI syntax in my .env.local file:


However, this method doesn’t work and here is the error code I am getting:

MongoServerSelectionError: Invalid message size: 759714643, max allowed: 67108864
    at Timeout._onTimeout (/Users/andrew/Documents/Projects/ddodir-next/node_modules/mongodb/lib/sdam/topology.js:330:38)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { '' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    logicalSessionTimeoutMinutes: undefined
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!