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

ArgumentNullException in GetAccessTokenAsync #2

Closed
BenWhite27 opened this issue Dec 20, 2023 · 6 comments
Closed

ArgumentNullException in GetAccessTokenAsync #2

BenWhite27 opened this issue Dec 20, 2023 · 6 comments

Comments

@BenWhite27
Copy link

BenWhite27 commented Dec 20, 2023

I'm getting a Null Reference Exception when using the latest version. I've cloned the repository and tested my end that the AccessToken is deserialised as null even though it is present in the http response from paypal.

It appears that the Model objects in this library are configured for Newtonsoft.Json and v4 of Flurl replaced the default serialiser with System.Text.Json.

From: https://flurl.dev/docs/configuration/#serializers

Flurl provides default implementations for both. It's very unlikely you'll need to use a different UrlEncodedSerializer, but there's a couple reasons you may want to swap out the JsonSerializer:

  1. You prefer the Newtonsoft-based version from 3.x and earlier. (4.0 replaced this with a System.Text.Json-based version.) This is available with the the Flurl.Http.Newtsonsoft companion package.

I'm not that familiar with Flurl, but I can't seem to find anything suggesting it's been configured for Newtonsoft.Json.

@mattbrailsford Sorry for the ping but this seems pretty critical.

@mattbrailsford
Copy link
Contributor

@BenWhite27 good spot, and that does indeed look to be the issue.

We have a task to test these against System.Text.Json but for the time being I've added a dependency to Flurl.Http.Newtonsoft and update the code to use the NewtonsoftSerializer. I've pushed this to our nightly server https://docs.umbraco.com/umbraco-cms/fundamentals/setup/install/installing-nightly-builds if you want to give v13.0.1-preview.1 a try and see if that resolves the issue for you?

@BenWhite27
Copy link
Author

Thanks Matt, I'll see if I can get the nightly feed configured and working on Umbraco Cloud and report back.

@mattbrailsford
Copy link
Contributor

mattbrailsford commented Dec 20, 2023

I believe you should be able to add a NuGet.config to your project root https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#packagesources

@BenWhite27
Copy link
Author

Hi Matt
Thanks for the links, just tested and everything appears to be functional now. This is a new site and my first test with Umbraco Commerce Checkout so can't say I've tested everything but no HTTP 500's this time.

Merry Christmas

@mattbrailsford
Copy link
Contributor

Excellent. I’ll get a full release pushed out tomorrow but hopefully the preview gets you making progress on your build. Thanks for raising the issue 👍🏻

@mattbrailsford
Copy link
Contributor

Version 13.0.1 has now been pushed out with this fix in. Thanks again for reporting 👍

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

No branches or pull requests

2 participants