bchavez / Coinbase

:moneybag: A .NET/C# implementation of the Coinbase API.

Home Page:https://developers.coinbase.com/api/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FlurlParsingException when parsing created_at field from ListAccountsAsync()

lucaswalter opened this issue ยท comments

In my application I am attempting to iterate over each account and read in transaction data. During the API call I am getting this exception when the 'created_at' field is being parsed:

Flurl.Http.FlurlParsingException

Response could not be deserialized to JSON: GET https://api.coinbase.com/v2/accounts

Newtonsoft.Json.JsonSerializationException

Error converting value {null} to type 'System.DateTimeOffset'. Path 'data[7].created_at', line 1, position 4571.
Flurl.Http.Configuration.NewtonsoftJsonSerializer in Deserialize within Flurl.Http, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null
Flurl.Http.HttpResponseMessageExtensions+d__0`1 in MoveNext within Flurl.Http, Version=2.4.0.0, Culture=neutral, PublicKeyToken=null
System.ArgumentException

Could not cast or convert from {null} to System.DateTimeOffset.

In my code I am trying to retrieve the accounts by calling:
var accountsResponse = await client.Accounts.ListAccountsAsync();

Am I doing something incorrect with this usage?

Hello Lucas,

I don't know. You're probably not doing anything wrong, most likely Coinbase again not very clear with their documentation on the JSON schema being returned.

Please use Fiddler and enable the proxy debugging feature in CoinbaseClient.

var c = new Coinbase.CoinbaseClient();
c.EnableFiddlerDebugProxy("http://localhost.:8888")

Then post me the anonymized JSON you received that caused your CLR stack to pop. Once I have the JSON I should be able to write a unit test.

Thanks,
Brian

Thanks for the reply Brian,

Unfortunately this exception is only being thrown on a live web application when other users are connecting through their OAuth token. I was unable to replicate this on my own account or any of my friends accounts who have accessed the website. Each of the exceptions were reported on Sentry.

Will this need to be replicated locally before I can get you that JSON? Or is there anything else I can do to get you more context?

Thanks

Hi Lucas,

Give Coinbase v5.0.7 a try. The new version should be published soon as this build is done:
https://ci.appveyor.com/project/bchavez/coinbase/builds/22646473

Keep an eye out and let me know if 91ff677 fixed the problem.

Thanks,
Brian

๐Ÿšถ ๐Ÿ˜Ž "So don't delay... act now supplies are running out..."

Wow, thank you for such the fast response Brian! I'll get that updated as soon as that build is done.

Best,
Lucas

No problem. ๐Ÿ˜Ž Thanks for reporting the issue ๐Ÿ‘

Just got the email notification: https://www.nuget.org/packages/Coinbase/5.0.7