Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5673

Issue with Deno Serve and MongoDB Atlas Serverless

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Deno
    • 3
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      I tried this example:

      import { MongoClient } from "npm:mongodb"
      import { ulid } from "https://deno.land/std@0.202.0/ulid/mod.ts";
      
      const client = new MongoClient("<url>")
      
      client.connect();
      
      Deno.serve(async () => {
      
        const data = await client.db("deno").collection("deno").insertOne({
          name: ulid()
        })
      
        return new Response(JSON.stringify({
          data
        }), {
          headers: { "Content-Type": "application/json" },
        })
      })
      

      and it failed with following error:

      Unable to find source-code formatter for language: noformat. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      MongoPoolClosedError: Attempted to check out a connection from closed connection pool
          at ConnectionPool.processWaitQueue (file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/cmap/connection_pool.js:520:45)
          at ConnectionPool.close (file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/cmap/connection_pool.js:284:14)
          at Server.destroy (file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/sdam/server.js:130:19)
          at destroyServer (file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/sdam/topology.js:409:12)
          at ext:deno_node/internal/util.mjs:93:15
          at new Promise (<anonymous>)
          at destroyServer (ext:deno_node/internal/util.mjs:78:12)
          at file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/sdam/topology.js:212:56
          at Function.from (<anonymous>)
          at Topology.close (file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/sdam/topology.js:211:40) {
        address: "ac-el7mrgl-lb.ks3woph.mongodb.net.:27017",
        [Symbol(errorLabels)]: Set(0) {}
      }
      error: Uncaught (in promise) MongoNetworkTimeoutError: connection timed out
          at connectionFailureError (file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/cmap/connect.js:381:20)
          at TLSSocket.<anonymous> (file:///C:/Users/Dan%20Cuatro/AppData/Local/deno/npm/registry.npmjs.org/mongodb/6.1.0/lib/cmap/connect.js:285:22)
          at Object.onceWrapper (ext:deno_node/_stream.mjs:1927:32)
          at TLSSocket.emit (ext:deno_node/_stream.mjs:1852:9)
          at TLSSocket._onTimeout (node:net:848:10)
          at cb (ext:deno_node/internal/timers.mjs:63:31)
          at Object.action (ext:deno_web/02_timers.js:151:11)
          at handleTimerMacrotask (ext:deno_web/02_timers.js:65:10)
          at eventLoopTick (ext:core/01_core.js:189:21)
      Watcher Process failed. Restarting on file change...
      

      Environment:

      • Windows 11 Home 22H
      • deno 1.37.1 (release, x86_64-pc-windows-msvc)
      • v8 11.8.172.6
      • typescript 5.2.2
      • MongoDB Atlas serverless

            Assignee:
            Unassigned Unassigned
            Reporter:
            alex.bevilacqua@mongodb.com Alex Bevilacqua
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: