I have now implemented this as you said. But unfortunately that doesn't help either. I have been working on this problem for several days now and with all my observations and tests I can say that the exception does not always occur at the same time. It always tends to occur in the second half of the workflow. And it is definitely triggered from outside my code. Unfortunately, you can't see exactly from where in the exception's StackTrace.
That's why I suspected that you might still be sending distributed events somewhere, which then access the PaymentRequest. I overwrote everything I knew and I didn't find anything in the classes / handlers you sent me by email. Is there anywhere else in your codebase from the payment module (or in relation to the subscription) that still handles corresponding events?
I haven't mentioned anything else here, but I hope you have seen the mail with the logs (Log3.txt).
Sorry, but the log file is not complete... Loglevel was wrong again. I'll send another one later.
Unfortunately the same problem, even if I have now set autoSave: true for all UpdateAsync methods. I have sent you the log file.
I don't know what you mean exactly. This call alone does not lead to an exception. And I would like to know why this object is updated somewhere else outside of my code.
I have protected the HandleWebhookAsync method in my PalmaPaymentRequestAppService with a semaphore. This way, the various webhook events should not interfere with each other:
In addition, the error only occurs later when HandleInvoiceAsync has already been successfully processed.
I have sent you the log file by email. Also my implementation of StripePaymentGateway and PaymentRequestAppService.
Some background information: We need to save additional data from Stripe (invoice, CustomerId for link to the Stripe customer portal, ...). Since the WebHooks are processed in parallel and access the same PaymentRequest object, there are concurrency exceptions. I tried to secure this with a semaphore, but at the same time some of your code is still being executed somewhere. I have tried to switch off all distributed events so that I have it completely under my own control, but I have not yet succeeded.
Yes, I know, but then a complete deployment is necessary and that takes about 30 minutes... ;-) Do you need the EF messages?
I wanted to overwrite the configuration in Azure with the environment variables. This worked for the default MinimumLevel. For the EntityFramework, however, I don't think this works... I have no debug log messages in the file.
But I will send you the log file that I am currently receiving by e-mail.
I wanted to activate EnableSensitiveDataLogging according to your instructions.
But then I get the following error:
InvalidOperationException: No database provider has been configured for this DbContext. A provider can be configured by overriding the 'DbContext.OnConfiguring' method or by using 'AddDbContext' on the application service provider. If 'AddDbContext' is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.
I have solved the log configuration via appsettings.json. I think the following should be enough, right?
Hi, thanks for sending me the following files:
Unfortunately I could not find the cause in these files...
Where else is an update made on the PaymentRequest?