Umbraco Commerce Concurrency exception
# help-with-umbraco
m
Heyo, I'm currently experiencing an unexpected error with my local Umbraco Commerce instance. It was all working as expected then suddenly started throwing this error on a successful transaction. The order completes correctly, but it doesn't take me to the confirmation page. I'm using both the Stripe and Checkout packages, although the checkout is a copy of the source, rather than the nuget due to needing some additional functionality. The error appears to be coming from Umbraco Commerce itself, but i'm not sure why. I did accidently restart the site midway through a transaction so I wonder if somethings gone funky in the db? This is all is get form the error message
Copy code
System.Data.DBConcurrencyException: A Concurrency update occurred in table 'umbracoCommerceOrder' for primary key value(s) = 'a28b060c-6bed-4ab9-a433-019002723487' and version = '11'
   at Umbraco.Commerce.Infrastructure.Resiliency.PollyExecutionStrategyBase.ExecuteAsync[TResult](Func`2 operation, Func`2 verifySucceeded, CancellationToken cancellationToken)
   at Umbraco.Commerce.Core.UmbracoCommerceUnitOfWorkProvider.ExecuteAsync[T](IUnitOfWorkOptions options, Func`3 action, CancellationToken cancellationToken)
   at Umbraco.Commerce.Cms.Web.Controllers.UmbracoCommercePaymentController.CallbackWithRetry(IPaymentProvider paymentProvider, PaymentProviderContext ctx, Int32 retryCount, Int32 maxRetries)
Any assistance would be greatly appreciated. This is on Umbraco 13.3.2 and Umbraco Commerce 13.1.4.
@Matt Brailsford (HQ) any ideas?
m
Sounds like that could be the isssue. The error states that the order being modified has since been saved such that your version numbers are out of sync and so it would result in data being overwritten. Restarting the server may have caused the order to be re-persisted or, given it's stripe, it could have called the webhook twice causing the same order to be resaved and so the error is thrown.
m
Hmm, any idea on how to resolve the issue 😅 I tried restarting the site etc and it didn’t fix the issue. I imagine I’ll need to remove some stuff in the db maybe, but I’m not sure what should be deleted, without a breaking something else. I was also able to replicate the issue on the staging site, which has not had any orders prior to yesterday. Although it still needs the license sorted so it probably no an ideal test at the moment
I'm wondering if I'm doing something funky somewhere in my code (most likely 😅)
m
I’m seeing these types of errors also, on a couple of sites in production. I haven’t had time to debug it further yet, but I’ll follow this conversation and add any context when I can.
m
I am doing some modification of the order on the
OrderTransactionUpdatedNotification
that checks to see if an order have been finalised, then does some stuff. I wonder if during that processing Stripe is still trying to hit and endpoing, but as I'm changing the order, it's triggering the concurrency issye, although I would have thought by that point, the Stripe stuff would be finished
The annoying thing is that the order and payment etc all complete, it just errors when it tries to take you to the confirmation page I have configured
But that could also be a red herring 🤷🏻‍♂️
Actually scrap that, I have also tried completing an order that ignores that code and it still throws the error
Quick update on this for anyone following. I've discovered a potential bug in the Stripe payment provide that was likely adding to some confusion when trying to debug this. It turns out that when configuring the Stripe payment profiders
Continue URL
and other URL values, if you don't include a trailing slash, it ends up redirecting to the root Url. I've sumbitted an issue here for it - https://github.com/umbraco/Umbraco.Commerce.PaymentProviders.Stripe/issues/6 As for the concurrency issue, I think it's due to me making updates to the order during the
OrderTransactionUpdatedNotification
or
OrderStatusHandler
. I was under the impression that these would be hit after the redirect back to the site completes, or at least during it, so i'm not sure what exactly is triggering the error. I've been able to get a larger stack trace which makes it look like it's trying to render the
Cancel URL
page at the same time as the
Continue URL
, which I think then throws the concurrency error because i've updated the record by then. @Matt Brailsford (HQ) I don't suppose if you know whether this is something the Stripe Payment Provider intentionally does do you as I can't see anything that would be doing that in the Umbraco Checkout package. Here's the full stack trace for reference. https://cdn.discordapp.com/attachments/1249727586335199323/1252243099179024404/message.txt?ex=667181c4&is=66703044&hm=702b67cbdc2cda8c6873483dc0457737825677739351aacf2f756a286077cb38&
72 Views