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

Can't connect to AWS DocumentDB #273

Open
stewartmacgregor opened this issue Mar 5, 2019 · 13 comments
Open

Can't connect to AWS DocumentDB #273

stewartmacgregor opened this issue Mar 5, 2019 · 13 comments

Comments

@stewartmacgregor
Copy link

No description provided.

@ankhers
Copy link
Collaborator

ankhers commented Mar 5, 2019

This doesn't give me any information I can use to debug the issue. Are you getting an error message or anything? Are you willing to give me access to a database to look into the issue?

@ninad1487
Copy link

Hi @ankhers,

We're trying to connect AWS DocumentDB from Elixir/Phoenix framework.

Seems like the authentication has an issue as below lines:
https://github.com/ankhers/mongodb/blob/master/lib/mongo/auth/scram.ex#L33
https://github.com/ankhers/mongodb/blob/master/lib/mongo/auth/scram.ex#L54

The function expects conversationId : 1, but we are observing different values than 1. After fixing this locally, any query returns the error errmsg: Legacy opcodes are not supported, code: 303. It seems that documentDB supports mongodb 3.6 API, but the driver is based on older opcodes. We would appreciate any thoughts on this.

We’d be open to providing access to a test database and environment if needed.

@stewartmacgregor
Copy link
Author

@ankhers Please see https://github.com/AlimovSV/mongodb/tree/docdb for a temporary fix.

@ankhers
Copy link
Collaborator

ankhers commented Mar 14, 2019

Thank you for following up. I believe I have actually started work on moving away from the older opcodes but never finished the work. But I would be glad to finish the work I had previously started. If you could contact me privately (you should be able to find my email on my profile page here) in order to get access to a test database that I can verify my changes against, it would be appreciated.

@ankhers
Copy link
Collaborator

ankhers commented May 6, 2019

Closing due to inactivity. If you get me the information I requested, I would be glad to reopen this.

@ankhers ankhers closed this as completed May 6, 2019
@christopherlai
Copy link

@ankhers I ran into a similar issue as well.

Mongo.Auth.SCRAM.first/5 expects conversationId to be 1, but in my situation that number was much higher (17842 as an example).

I would be open to setting up a DocumentDB cluster for troubleshooting this issue.

@christopherlai
Copy link

I also noticed that Mongo.Auth.SCRAM.second/2 receives "done" => true instead of false.

@jethro-solve
Copy link

We've run into the same issue when testing feasibility of using DocumentDB with an Elixir application. I've taken the work referenced above by @AlimovSV and refactored it so that it's mergable against master again for easy testing/experimenting.

master...solvedata:master

With these changes, I can successfully authenticate to DocumentDB with TLS disabled (haven't looked into TLS yet) and run queries.

Rough and ready example of my test setup. I'm not an Elixir programmer, so there's probably a smarter method, but this works:

docker run --rm -it elixir:latest bash

mix new test
cd test

cat > mix.exs << EOF
defmodule Test.MixProject do
  use Mix.Project

  def project do
    [
      app: :test,
      version: "0.1.0",
      elixir: "~> 1.9",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger, :mongodb, :poolboy]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
  [{:mongodb, git: "https://github.com/solvedata/mongodb.git" },
   {:poolboy, ">= 0.0.0"}]
  end
end
EOF

mix deps.get

iex -S mix

{:ok, conn} = Mongo.start_link(url: "mongodb://user:pass@URL:27017/test")

I chucked some data into the DB and was able to query back via Elixir, but haven't tested all the different query types possible.

Next steps - @ankhers would it be helpful if I got you a test DocumentDB cluster? No issues from my side setting one up for you to use for a couple weeks if that's helpful.

@ankhers
Copy link
Collaborator

ankhers commented Jul 17, 2019

Thank you both for looking into this.

If either of you can email me credentials to a DocumentDB cluster, I can look into what needs to be done.

@jethro-solve, can you put up a PR with those changes so that I can test against them and potentially merge?

@jethro-solve
Copy link

Nice thanks @ankhers - I've just emailed through creds and details to a test DocumentDB setup and have raised PR #304

@christopherlai
Copy link

@ankhers and @jethro-solve thanks for looking into this.

@ankhers
Copy link
Collaborator

ankhers commented Jul 25, 2019

I just wanted to keep on top of this ticket since @jethro-solve was kind enough to provide a DB to test against. Unfortunately I have been overwhelmed at home and work this past week, I am hoping to find some time over the weekend to take a look at what is going on.

@jethro-solve
Copy link

thanks @ankhers - no problem, happy to keep the DB around until you get a chance.

foggy1 pushed a commit to VodyTV/mongodb that referenced this issue Sep 9, 2019
foggy1 pushed a commit to VodyTV/mongodb that referenced this issue Dec 11, 2019
foggy1 pushed a commit to VodyTV/mongodb that referenced this issue Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants