Skip to content
This repository has been archived by the owner on Apr 27, 2019. It is now read-only.

Does not work on netcoreapp2.1 #121

Open
MortalFlesh opened this issue Aug 2, 2018 · 5 comments
Open

Does not work on netcoreapp2.1 #121

MortalFlesh opened this issue Aug 2, 2018 · 5 comments

Comments

@MortalFlesh
Copy link

Hello,
I'm trying to implement a simple app to read values from consul.KV.
I've made an example app in F# using you library. Code is here: https://github.com/MortalFlesh/fsharp-consul

It works fine, when I'm using netcoreapp2.0.

Get value for "some/key" ...
Key: some/key | Value: "some value"

I have a private instance of consul, so I can't give you live example data..

But when I change netcoreapp2.0 to netcoreapp2.1 it does not work..

Get value for "some/key" ...
Key: some/key | Value: "<null-response>"

<null-response> is a fallback when client.KV.Get(key).Result.Response is null

code is here https://github.com/MortalFlesh/fsharp-consul/blob/master/Program.fs#L18

I'm running the code on Mac OS High Sierra 10.13.6 with

dotnet --version
2.1.302

I have a problem with client.KV.List() as well, but I wanted to simplify this as much as possible.
Do you know what might be the problem? Am I doing something wrong?

Thanks for you reply.

@johnfg2610
Copy link

Hey, I'm also using net core 2.1 and C# and it seems to be working as expected for me

using (var client = new ConsulClient(opt => { opt.Address = new Uri("http://localhost:32822");}))
{
    var result = await client.KV.Get("database/connectionstrings/
}

Im not sure about F# never used, but i know it does work on .net core 2.1, sorry i couldnt be of more assitance

@MortalFlesh
Copy link
Author

I have same problem in C# as well ..

using (var client = new ConsulClient(opt => { opt.Address = new Uri("...consul-url...");}))
{
    var result = client.KV.List("config");
    Console.WriteLine("Result: " + result.Result.StatusCode);
    Console.WriteLine("Result: " + result.Result.Response);
}

ends up with

2.0

Result: OK
Result: Consul.KVPair[]

2.1

Result: NotFound
Result:

The code, url, prefix and everything is same I just change from <TargetFramework>netcoreapp2.0</TargetFramework>
to <TargetFramework>netcoreapp2.1</TargetFramework>.

So @johnfg10 are you really sure that it works for you? Because I have some result but there is an invalid response in it.

@johnfg2610
Copy link

Mayby try using client.KV.get()

@MortalFlesh
Copy link
Author

It doesn't really matter which method I use. Both of them works fine on 2.0 - List returns all Pairs with prefix and Get returns a single Pair - but both of them returns a Not found response on 2.1.

@johnfg2610
Copy link

johnfg2610 commented Aug 10, 2018

Ok so I've tested further it 100% works for me maybe its a mac issue because of this code:

        public async void test()
        {
            Console.WriteLine("test start");
            using (var client = new ConsulClient(opt => { opt.Address = new Uri("http://localhost:8500");}))
            {
                var result = await client.KV.List("test");
                foreach (var kvPair in result.Response)
                {
                    Console.WriteLine(kvPair.Key);
                    Console.WriteLine(Encoding.UTF8.GetString(kvPair.Value));
                }
            }
            Console.WriteLine("test end");
        }

prints this in console

test start
test/one
test one
test/two
test two
test end

which is the values in my consul key store.
You can also see here that the version is definitely 2.1
image

I have attached the test app I made so you can test, but I know 100% it's working for me on windows
testapp1.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants