Skip to content

GetOrCreateCurrentOrder is throwing Object reference not set to an instance of an object #578

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

Closed
warrentheranga opened this issue Oct 24, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@warrentheranga
Copy link

A simple "Add To Cart" SurfaceController that was working fine 2 weeks ago now fails to run after jumping back in and firing up the project again.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Load up the product page, i.e. https://localhost:44309/store/products/test-product
  2. Click on 'Add To Cart'
  3. See the error

Expected behavior
The order should be created

Screenshots
Screenshot 2024-10-24 at 6 35 14 PM
Screenshot 2024-10-24 at 6 36 40 PM

NullReferenceException: Object reference not set to an instance of an object.
Umbraco.Commerce.Infrastructure.Resiliency.PollyExecutionStrategyBase.Execute<TResult>(Func<TResult> operation, Func<ExecutionResult<TResult>> verifySucceeded)
Umbraco.Commerce.Core.UmbracoCommerceUnitOfWorkProvider.Execute<T>(IUnitOfWorkOptions options, Func<IUnitOfWork, T> action)
Umbraco.Commerce.Core.UmbracoCommerceUnitOfWorkProvider.Execute<T>(Func<IUnitOfWork, T> action)
Umbraco.Commerce.Core.Session.SessionManager.GetOrCreateCurrentOrder(Guid storeId, string customerReference)
Umbraco.Commerce.Core.Session.SessionManager.GetOrCreateCurrentOrder(Guid storeId)
AtlasLogic.Core.Controllers.CartSurfaceController.AddToCart(AddToCartDto postModel) in CartSurfaceController.cs
+
                    var order = _sessionManager.GetOrCreateCurrentOrder(testStoreId)
lambda_method15373(Closure , object , object[] )
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

Additional context
We are running Umbraco.Commerce.Checkout 13.1.0 project from Github - no change in several weeks

Umbraco Commerce version:
Umbraco.Cms 13.4.1
Umbraco Commerce 13.1.6

@warrentheranga warrentheranga added the bug Something isn't working label Oct 24, 2024
@mattbrailsford
Copy link
Contributor

mattbrailsford commented Oct 24, 2024

Linked to #565 please upgrade to Umbraco Commerce 13.1.10 and confirm if the issue is still present after the upgrade.

@warrentheranga
Copy link
Author

Linked to #565 please upgrade to Umbraco Commerce 13.1.10 and confirm if the issue is still present after the upgrade.

Yes, confirmed working. Thank you

@mattbrailsford
Copy link
Contributor

Just a heads up, 13.1.12 has been released which fixes some further regressions connected to the same issue so you may wish to upgrade when you have the chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants