Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support atlas shared cluster #337

Open
nyxb opened this issue Feb 27, 2022 · 10 comments
Open

feat: support atlas shared cluster #337

nyxb opened this issue Feb 27, 2022 · 10 comments
Labels
atlas Everything About MongoDB Atlas enhancement New feature or request help wanted Extra attention is needed

Comments

@nyxb
Copy link

nyxb commented Feb 27, 2022

Database conected right after a short time get error error:

Uncaught (in promise) Error: MongoError: "Invalid response header" if (!headerBuffer) throw new MongoDriverError("Invalid response header");
                               ^
at WireProtocol.receive (https://deno.land/x/mongo@v0.29.2/src/protocol/protocol.ts:106:32)

I connect with srv url

my code

import { MongoClient } from "https://deno.land/x/mongo@v0.29.2/mod.ts";
import { logger } from "../utils/logger.ts";
import { configs } from "../../configs.ts";

const log = logger({ name: "DB Manager" });

log.info("Initializing Database 👀");

const client = new MongoClient();
const db = configs.DATABASE;

client.connect(
  "mongodb+srv://vidar:[]password@discordenobot.ldfgs.mongodb.net/DiscordenoBot?authMechanism=SCRAM-SHA-1"
);

log.info("Database connected successfully ✅");

Normally the srv url is in env. if i produce the same on node i get no error

@lucsoft
Copy link
Collaborator

lucsoft commented Feb 27, 2022

Hm yeah we have some trouble with MongoDB Atlas

@nyxb
Copy link
Author

nyxb commented Feb 27, 2022

So hope it goes in few times need it. pls inform me here if it fixed.

@erfanium
Copy link
Member

erfanium commented Feb 27, 2022

Which MongoDB atlas service do you use?
https://mongo-demo.deno.dev/ works fine with M0 free tier

@nyxb
Copy link
Author

nyxb commented Feb 27, 2022

Which MongoDB atlas service do you use?
https://mongo-demo.deno.dev/ works fine with M0 free tier

I told it in my Post it's MongoDB Atlas
https://www.mongodb.com/atlas/database

@erfanium
Copy link
Member

erfanium commented Feb 27, 2022

@VidarDev MongoDB Atlas has many different clusters. like serverless clusters, dedicated clusters and shared clusters. I can confirm there's not problem with fee M0 tier of dedicated cluster. Also we know serverless clusters are not supported yet.

So make sure you created a dedicated M0 cluster with default options

@nyxb
Copy link
Author

nyxb commented Feb 27, 2022

@erfanium

i have a M0 shared Cluster

So I can use shared for free, dedicated not.
is shared supported?

N22H95W

mine is hosted in the cloud. And not locally. Can this be the problem?

@erfanium erfanium changed the title Invalid response header feat: support atlas shared cluster Feb 27, 2022
@erfanium erfanium added enhancement New feature or request help wanted Extra attention is needed labels Feb 27, 2022
@nyxb
Copy link
Author

nyxb commented Feb 27, 2022

ok now i generate a cluster local and not cloud and it goes.

So any ATA for use clouded and serverless?

@nyxb nyxb closed this as completed Feb 27, 2022
@lucsoft
Copy link
Collaborator

lucsoft commented Feb 27, 2022

why did you close it? we should improve our atlas support

@lucsoft lucsoft reopened this Feb 27, 2022
@nyxb
Copy link
Author

nyxb commented Feb 27, 2022

sry didnt want close it 🙈

@lucsoft lucsoft added the atlas Everything About MongoDB Atlas label Apr 11, 2022
@diecodev
Copy link

diecodev commented Jul 5, 2022

Hm yeah we have some trouble with MongoDB Atlas

@VidarDev I recommend you to use the object version it is faster than srv url:

await client.connect({
    db: "<db_name>",
    tls: true,
    servers: [
    /* 
         You can pass the 3 shared cluster url, just copy and paste the object below
        three times and edit every single cluster url.
    */
    {
      host: "<db_cluster_url>",
      port: 27017,
    },
  ],
  credential: {
    username: "<username>",
    password: "<password>",
    db: "<db_name>",
    mechanism: "SCRAM-SHA-1",
  },
});

If, we connect to Atlas DB using srv url, it will take too long but we can use the general cluster url generated by mongodb Atlas.

Pd. Sorry by my English, I am learning. 🖖🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
atlas Everything About MongoDB Atlas enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants