coronabytes / dotnet-arangodb

.NET Driver for ArangoDB
Apache License 2.0
67 stars 18 forks source link

Trying to connect but I get unknown path '/_open/auth' #24

Closed SuheylZ closed 3 years ago

SuheylZ commented 3 years ago

Following is the simplest code I can write for the default local installation.

    using System;
    using Core.Arango;

    namespace ConsoleApp1
    {
    class Program
    {
        static void Main(string[] args)
        {

            try
            {
                 var ctx = new ArangoContext("Server=http://192.168.60.130:8529;User=root;");

                var t0 = ctx.Database.ListAsync().GetAwaiter().GetResult();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

           }
        }
    }

yet I keep getting this error:

Core.Arango.ArangoException: {"error":true,"code":404,"errorNum":404,"errorMessage":"unknown path '/_open/auth'"} at Core.Arango.Transport.ArangoHttpTransport.SendAsync[T](HttpMethod m, String url, Object body, String transaction, Boolean throwOnError, Boolean auth, IDictionary2 headers, CancellationToken cancellationToken) at Core.Arango.Transport.ArangoHttpTransport.Authenticate(Boolean auth, CancellationToken cancellationToken) at Core.Arango.Transport.ArangoHttpTransport.SendAsync[T](HttpMethod m, String url, Object body, String transaction, Boolean throwOnError, Boolean auth, IDictionary2 headers, CancellationToken cancellationToken) at Core.Arango.Modules.Internal.ArangoDatabaseModule.ListAsync(CancellationToken cancellationToken) at ConsoleApp1.Program.Main(String[] args) in /projects/learning/ConsoleApp1/ConsoleApp1/Program.cs:line 15

What am I doing wrong here?

coronabytes commented 3 years ago

Hi, Quick Fix: Set an arangodb password.

I need to support NO_AUTH at the driver level

SuheylZ commented 3 years ago

I don;t think so if that's the problem because I made change and added password after setting the root password and the problem is still the same. Setting the database password means setting the root password, right?

coronabytes commented 3 years ago

I think you're running arango instance with noauth, which is not supportet right now. No auth seems to disable /_open/auth endpoint

services:
  agency:
    image: arangodb/arangodb:3.8.0
    restart: unless-stopped
    environment:
      #ARANGO_NO_AUTH: 1
      ARANGO_ROOT_PASSWORD: ""
SuheylZ commented 3 years ago

I'm recently started looking into arango db so I don't have much knowledge. where do I set this?

coronabytes commented 3 years ago

Just update to 3.8.202, which should release in a few minutes.

however you need to change your connection string:

var ctx = new ArangoContext("Server=http://192.168.60.130:8529;");

no user now implies no_auth

SuheylZ commented 3 years ago

works now image

Thanks a lot