Umbraco crashes without Security and Licences Permission
Umbraco 7.7.13 - upgraded from 7.6.13 which added new User management.
After upgrading Umbraco, I found that a user (Umbraco login) had a problem when logging in. The login worked, but Umbraco showed an error message and none of the icons down the left hand side appeared. Logging in worked fine for me and another user.
Long story short - it turned out that I had to tick "Security" and "Licences" in the TeaCommerce permissions for the user. With those ticked, Umbraco works fine. Untick either one and the error returns!?
It is handy that I've found the problem, but the solution is not ideal. I don't want to give everyone access to the "Security" settings!
You may need to bare in mind however, 3.3.1 has the SCA update to the Stripe payment provider in it which does require changed to the providers setup. This is documented on the payment providers docs page however https://docs.teacommerce.net/3.3.1/payment-providers/stripe/
Regarding the changes required - is it just the Webhook setup that is new?
Your documentation page says:
Click Developers and then Webhooks in the left hand side menu. On the
right hand side, click Add Endpoint and enter the Tea Commerce
cummunication URL as follows (replacing the parameters in square
brackets with the corisponding values taken from your store):
Regarding the IDs, you are absolutely right that we don't have a friendly way of getting those, I'll definitely look at a better way to grab them, but for the time being, if you go to edit the payment provider, right click in the edit area and choose "view frame source", you can then grab them from the querystring
id relates to the payment method ID, and storeId is the store id.
That's right yea, I think just adding the webhook secrets would be enough to get it started. There are a few settings that have been removed, but it won't hurt if they are still there (capture being one of them).
Anything that's not on the list in the docs can be safely removed.
These are essentially carts while they are not finalized. If they aren't finalized then I'm guessing it's because the webhook hasn't come through. Is this on your local machine? or on a live server? Have you looked in the log file for any errors?
Hmm, I've come across a similar error online to do with someone using ILMerge, which we do use to merge all the payment provider projects into one dll, but I've tested this locally with the merged dll, making an order, and I don't receive any errors so not sure why that would be.
In addition, we have this DLL deployed on the teacommerce.net website as this is what we use for our payments, and we have received payments ok.
Good question! I did an update of TeaCommerce using TeaCommerce3.3.1forUmbraco_7.zip. I only did that on my local dev, I then copied all changed files, with other application changes, to the testing server.
Do I need to manually install the TeaCommerce upgrade on each server?
I wonder what version of json.net you have installed as it's because of the deserialization that's causing an issue
This should be embeded in the payment provider dll for each provider that needs it, but I wonder if that's not working and so it's using the version in the bin folder and if it's an old version, it could be an issue
Any other ideas on how to debug / solve this issue? Is there a way that I can debug it locally?
Edit: Trying to use ngrok, as suggested on your page "Configure Stripe" page and that just gives "404" whenever I send a webhook test (from Stripe dashboard) :-(
Edit Again: got ngrok working! Now to see if it will help at all!
Hmm, the fact it has the Stripe907307 stuff in there tells me it is using the JSON.NET library that has been bundled in the payment providers dll. I'm still not sure why it's failing though as I've looked in the DLL and the JsonPropertyAttribute.NullValueHandling exists and like I say, I have this working on a couple of sites.
Best I could suggest right now is whether you can pull the source for the payment providers and run the build.cmd file (press r then u for the questions it asks), but before then modify the Build\Build.Prepare.targets file, line 65 and remove the flag for /internalize:ILMerge.exclude.txt and on line 83 add a /union flag after the /ndebug flag and see if that helps. The dll will be the Artifacts\Files\bin\TeaCommerce.PaymentProviders.dll file.
2019-07-15 14:41:06,787 [P5620/D8/T154] ERROR TeaCommerce.PaymentProviders.Inline.BaseStripeProvider - BaseStripeProvider - GetWebhookStripeEvent
System.TypeLoadException: Could not load type '<>c' from assembly 'TeaCommerce.PaymentProviders, Version=3.1.7135.25744, Culture=neutral, PublicKeyToken=null' because the method 'DeserializeObject<TeaCommerce.PaymentProviders.Classic.QuickPay10+Result>' has no implementation (no RVA).
at Stripe.Mapper`1.MapFromJson(String json, String parentToken, StripeResponse stripeResponse)
at Stripe.EventUtility.ParseEvent(String json, Boolean throwOnApiVersionMismatch)
at TeaCommerce.PaymentProviders.Inline.BaseStripeProvider.GetWebhookStripeEvent(HttpRequest request, String webhookSecret)
Does that help in any way? I tried adding the Providers project to mine, to try and debug, but it won't compile (complains about 2 versions of Newtonsoft)
Ahh, yea, that does ring a bell and is why I removed the /union call in the first place. I was hoping by removing the /internalize bit that it wouldn't be a problem, but I guess it is.
Final thing then would be launch the sln file and compile the solution manually in release mode, then remove the TeaCommerce.PaymentsProvider.dll from your projects bin folder and copy over the individual dlls for the payment providers you want to support, plus their dependencies. By compiling them manually, there will be no merging of DLLs and you'll end up using the version of JSON.NET that is in the bin folder.
I'll have a look into whether the ILMerging can be done in another way, but like I say, I can't for the life of me figure out why it's working on two of my installs and not on yours so I think for the time being at least you'll be better of using your build of the dlls as it clearly doesn't like the one that comes with TC directly.
You'll probably want to remove the other DLLs you copied over whilst testing. I haven't done any tests with it myself, I've just got the merging working.
Let me know how you get on and if it's any better, I may swap out ILMerge for ILRepack.
I've got a feeling it could well work as looking into the dll with dotpeek the issue you posted above with the weird <>c type error is due to ILMerge union doing weird things, but looking at the dll from ILRepack it doesn't generate that error, so this might be the solution, to switch to using ILRepack.
well, OK - I have removed the individual DLL's for Stripe and put the new DLL in and it seems to work. I have only tried sending test webhook calls from the Stripe dashboard, but that was generating errors before.
Next, I would need to try it on our dev server and generate some actual orders. I will do that first thing tomorrow.
I have put the new DLL onto our Dev server and after sending test webhook calls from Stripe, I get apparent success at the Stripe end and this in the website log file:
2019-07-16 09:21:14,621 [P9496/D2/T47] INFO TeaCommerce.PaymentProviders.Inline.Stripe - Form:
However, making an order on our Dev website still does not work (order stays as a cart). There are no messages in the log file.
And you have stripe configured to post webhooks to your dev servers URL? Also, there are separate webhook registrations for live and test mode so you have configured the webhook relevant to the mode of your payment provider?
I copied the DLL you created yesterday, replacing the one that comes with the current 3.3.1 release package. I sent test webhook calls from Stripe to the Dev server which worked and gave the simple log entry above. I then made an order and paid via the Stripe payment provider.
The "order" stayed as a Cart, the basket was not emptied, there is no record of any Stripe activity in the website log nor on the Stripe website.
So you managed to make payment on your dev server, and it did all the redirecting to the confirmation page, but nothing appeared at all in Stripe or the back office?
I don't even know how that is possible, as if the order page worked, that would have created something in Stripe (are you sure you don't have dev setup in live mode or something so you aren't seeing the order because its in the live view or visa versa?) or errored.
Are you seeing any JS errors on the order screen where you input the credit card details? Only thing I could think is that the JS isn't running at all and so it doesn't intercept and block the form submitting until stripe has done it's thing like it should.
It really sounds like the JS for Stripe isn't running at all. You've definitely updated your view with the latest from github and pushed to your dev server?
Hmm, have you setup your TC countries with a 'Region Code' of en-GB? It should be a two letter country code really, so just GB as en-GB is a language reference rather than a country reference.
PS A different error means we are making progress so don't worry, we will get there 👍
I didn't set this site up (at least, not TC). Also, I haven't changed anything so it was either working or being ignored previously. I've changed it to GB.
So, now to make a coffee and make sure all the working bits are all in the right place, so I don't lose them!!
I upgraded to the latest version of TeaCommerce, 3.3.1, from 3.3.0. I made no other changes to code (except for the payment page as above).
I have just debugged the code locally and the "NotificationCenter.Order.Finalized" routine is called. No errors happen and it runs the "RemoveCurrentOrder" line of code, above.
The basket used to empty before upgrading and implementing the new Stripe provider, now it doesn't. It does still work (the basket clears) on our Staging website, which is running TeaCommerce 3.3.0 and the previous Stripe payment processor.
Are you saying the TC.RemoveCurrentOrder method call isn't clearing the basket either?
The only thing that was introduced in 3.3.1 regarding the saving of orders was that it's now wrapped in a transaction, but can't see how that would cause this.
I added the "var r = " bit so that I could see what it returned (null). immediately after the call, "order" still seems to be populated with the same values.
I assume the basket should be cleared automatically, without having to add extra code? Could the TC code be upset by me having code that references the "order" during the "Order_Finalized" routine?
Ok, can I check, on your Stripe payment form, what is it set to submit to? it should be set to action="@Request.Form["continue_url"]"
Essentially, when you hit this continue URL, this will post to TC which will set the current order to be the current finalized order in the session controller and also removes it as the current order and THEN redirects to the confirmation page URL.
I am wondering, if rather than submitting to TCs continue URL, it is actually just being sent to the confirmation page, skipping the continue callback, thus skipping clearing the session.
No, I was wondering if you'd hard coded the form to be action="/en/store/cart-content/confirmation/" not knowing that Request.Form["continue_url"] isn't just a straight reference to that setting.
Damn it! I was really hoping that was it as I really don't know why it's not clearing it then.
Honestly, no. I've exhausted everything I can think of. Only thing I can suggest now is to send over a complete backup of your site (removing any sensitive information) and I'll just have to try and replicate it and see what's going on.
Umbraco crashes without Security and Licences Permission
Umbraco 7.7.13 - upgraded from 7.6.13 which added new User management.
After upgrading Umbraco, I found that a user (Umbraco login) had a problem when logging in. The login worked, but Umbraco showed an error message and none of the icons down the left hand side appeared. Logging in worked fine for me and another user.
Long story short - it turned out that I had to tick "Security" and "Licences" in the TeaCommerce permissions for the user. With those ticked, Umbraco works fine. Untick either one and the error returns!?
It is handy that I've found the problem, but the solution is not ideal. I don't want to give everyone access to the "Security" settings!
Any idea what might be causing this?
What version of Tea Commerce are you running on?
v3.3.0 ... I think!
You might need to update to 3.3.1 then, there was a fix for this in that release. See the changelog here https://docs.teacommerce.net/changelog/3.x/
You may need to bare in mind however, 3.3.1 has the SCA update to the Stripe payment provider in it which does require changed to the providers setup. This is documented on the payment providers docs page however https://docs.teacommerce.net/3.3.1/payment-providers/stripe/
Matt
Ah, OK! That could solve 2 issues / jobs in one then :-) I'll try upgrading.
Regarding the changes required - is it just the Webhook setup that is new?
Your documentation page says:
Umm, where do I take the values from in my store?! (sorry, probably really obvious but I can't see them).
Hey Gordon,
Good questions.
Upgrading the Stripe provider is a 3 step process.
1) Register webhooks with stripe and record it's secret
2) Reload and re fill in the payment provider settings (you'll want to copy these before you click "load defaults")
3) Update the payment forms markup with the code found here https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.UI/Views/Partials/StripePaymentForm.cshtml
Regarding the IDs, you are absolutely right that we don't have a friendly way of getting those, I'll definitely look at a better way to grab them, but for the time being, if you go to edit the payment provider, right click in the edit area and choose "view frame source", you can then grab them from the querystring
id relates to the payment method ID, and storeId is the store id.
Thanks for pointing this out :)
Matt
Looking at the config values here https://docs.teacommerce.net/3.3.1/payment-providers/stripe/#configure-stripe and comparing to our current setup, it looks like I just need to add the "webhook" settings.
However, we have a "capture" setting (set to true), but that doesn't appear on your list? Do I keep it or delete it?
Hi Gordon,
That's right yea, I think just adding the webhook secrets would be enough to get it started. There are a few settings that have been removed, but it won't hurt if they are still there (capture being one of them).
Anything that's not on the list in the docs can be safely removed.
Matt
Umm, it doesn't seem to be working right now:
I made one order, but got these two entries, neither of which are completed. E.g. they do not appear as an "Order".
Why am I getting duplicate orders and why isn't it completing? Any suggestions on what to look at / check?
Hey Gordon,
These are essentially carts while they are not finalized. If they aren't finalized then I'm guessing it's because the webhook hasn't come through. Is this on your local machine? or on a live server? Have you looked in the log file for any errors?
Give those a try and see what you find.
Matt
Ah, look what I found:
The site is on an Internet facing / accessible server. Testing the webhook from the Stripe dashboard appears to work?
Hmm, that's interesting. What version of .NET is the site running under?
And at what stage does that error occur?
Server .Net version is 4.7.2661.0 Project compiled against Framework 4.5.1
I assume the error was when I made the order, but you don't see anything on-screen.
I just did a test "webhook" call from the Stripe Dashboard and got this in the Umbraco log:
Hmm, I've come across a similar error online to do with someone using ILMerge, which we do use to merge all the payment provider projects into one dll, but I've tested this locally with the merged dll, making an order, and I don't receive any errors so not sure why that would be.
In addition, we have this DLL deployed on the teacommerce.net website as this is what we use for our payments, and we have received payments ok.
Or all your DLLs up to date?
Good question! I did an update of TeaCommerce using TeaCommerce3.3.1forUmbraco_7.zip. I only did that on my local dev, I then copied all changed files, with other application changes, to the testing server.
Do I need to manually install the TeaCommerce upgrade on each server?
No, as long as all the DLLs are transferred over, it should be self installing/upgrading.
This is the TeaCommerce DLLs
I wonder what version of json.net you have installed as it's because of the deserialization that's causing an issue
This should be embeded in the payment provider dll for each provider that needs it, but I wonder if that's not working and so it's using the version in the bin folder and if it's an old version, it could be an issue
Umm, there is Newtonsoft.Json.dll, version 10.2.20802 in the bin folder?
Hmm, that's weird, those are the same versions as I have on a client site I recently upgraded so not sure why it wouldn't be working for you 🤔
Any other ideas on how to debug / solve this issue? Is there a way that I can debug it locally?
Edit: Trying to use ngrok, as suggested on your page "Configure Stripe" page and that just gives "404" whenever I send a webhook test (from Stripe dashboard) :-( Edit Again: got ngrok working! Now to see if it will help at all!
I have success (?) with doing a test webhook call from the Stripe dashboard:
But I still get an error in the website log:
Not sure what I can do to test / debug locally?
my Newtonsoft.Json.dll details:
Hey Gordon,
Hmm, the fact it has the
Stripe907307
stuff in there tells me it is using the JSON.NET library that has been bundled in the payment providers dll. I'm still not sure why it's failing though as I've looked in the DLL and theJsonPropertyAttribute.NullValueHandling
exists and like I say, I have this working on a couple of sites.Best I could suggest right now is whether you can pull the source for the payment providers and run the build.cmd file (press
r
thenu
for the questions it asks), but before then modify theBuild\Build.Prepare.targets
file, line 65 and remove the flag for/internalize:ILMerge.exclude.txt
and on line 83 add a/union
flag after the/ndebug
flag and see if that helps. The dll will be theArtifacts\Files\bin\TeaCommerce.PaymentProviders.dll
file.https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers
I now get this in the log:
Does that help in any way? I tried adding the Providers project to mine, to try and debug, but it won't compile (complains about 2 versions of Newtonsoft)
Ahh, yea, that does ring a bell and is why I removed the
/union
call in the first place. I was hoping by removing the/internalize
bit that it wouldn't be a problem, but I guess it is.Final thing then would be launch the sln file and compile the solution manually in release mode, then remove the
TeaCommerce.PaymentsProvider.dll
from your projects bin folder and copy over the individual dlls for the payment providers you want to support, plus their dependencies. By compiling them manually, there will be no merging of DLLs and you'll end up using the version of JSON.NET that is in the bin folder.Well, I compiled the project and copied the following:
TeaCommerce.PaymentProviders.Stripe.dll
Stripe.net.dll
System.Collections.Immutable.dll
to my project - and now the test calls from the Stripe dashboard work without causing an error to appear in the Umbraco log. I just get this:
So, is this the only solution, or is there a way to fix it so that I can just use the "normal" paymentproviders DLL?
Hi Gordon,
I'll have a look into whether the ILMerging can be done in another way, but like I say, I can't for the life of me figure out why it's working on two of my installs and not on yours so I think for the time being at least you'll be better of using your build of the dlls as it clearly doesn't like the one that comes with TC directly.
I'll keep you posted.
Matt
If you fancied trying this out, I have just compiled a new DLL this time using ILRepack rather than ILMerge incase that makes a difference. You can find the DLL here: https://www.dropbox.com/s/v3wxawpkosd5bq7/ILRepack.TeaCommerce.PaymentProviders.dll.zip?dl=0
You'll probably want to remove the other DLLs you copied over whilst testing. I haven't done any tests with it myself, I've just got the merging working.
Let me know how you get on and if it's any better, I may swap out ILMerge for ILRepack.
Matt
I've got a feeling it could well work as looking into the dll with dotpeek the issue you posted above with the weird
<>c
type error is due to ILMerge union doing weird things, but looking at the dll from ILRepack it doesn't generate that error, so this might be the solution, to switch to using ILRepack.Let me know
Matt
well, OK - I have removed the individual DLL's for Stripe and put the new DLL in and it seems to work. I have only tried sending test webhook calls from the Stripe dashboard, but that was generating errors before.
Next, I would need to try it on our dev server and generate some actual orders. I will do that first thing tomorrow.
Perfect! Thanks Gordon.
Appreciate you trying it out 👍
Matt
I have put the new DLL onto our Dev server and after sending test webhook calls from Stripe, I get apparent success at the Stripe end and this in the website log file:
However, making an order on our Dev website still does not work (order stays as a cart). There are no messages in the log file.
And you have stripe configured to post webhooks to your dev servers URL? Also, there are separate webhook registrations for live and test mode so you have configured the webhook relevant to the mode of your payment provider?
I followed the instructions here (except for the Radar bit) -
https://docs.teacommerce.net/3.3.1/payment-providers/stripe/#configure-stripe
I copied the DLL you created yesterday, replacing the one that comes with the current 3.3.1 release package. I sent test webhook calls from Stripe to the Dev server which worked and gave the simple log entry above. I then made an order and paid via the Stripe payment provider.
The "order" stayed as a Cart, the basket was not emptied, there is no record of any Stripe activity in the website log nor on the Stripe website.
So you managed to make payment on your dev server, and it did all the redirecting to the confirmation page, but nothing appeared at all in Stripe or the back office?
I don't even know how that is possible, as if the order page worked, that would have created something in Stripe (are you sure you don't have dev setup in live mode or something so you aren't seeing the order because its in the live view or visa versa?) or errored.
Are you seeing any JS errors on the order screen where you input the credit card details? Only thing I could think is that the JS isn't running at all and so it doesn't intercept and block the form submitting until stripe has done it's thing like it should.
Matt
There are no errors on the payment page and it does go to the confirmation page.
TeaCommerce has the Cart, but does not show it as an order:
The Stripe dashboard shows:
Is there anything you would like to see in the above log?
Nothing shows in the Umbraco website log for Stripe at the time of the order.
It really sounds like the JS for Stripe isn't running at all. You've definitely updated your view with the latest from github and pushed to your dev server?
https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.UI/Views/Partials/StripePaymentForm.cshtml
Umm, I didn't realise / know there was a new version!? Did I miss that somewhere?
I am just comparing it now, but it will take a little while as our designer has amended it to suit our site.
Yea, I mentioned it in my 3 step upgrade process earlier https://our.umbraco.com/packages/website-utilities/tea-commerce/tea-commerce-support/98047-umbraco-crashes-without-security-and-licences-permission#comment-309275 It's the 3rd step.
The JS for Stripe was updated significantly due to the SCA changes, so yea, it needs updating too.
Oops, must have missed that!
Updated the code and now I get an error -
Grrr! (used to be OK - or previously ignored - as the data I'm using hasn't changed)
Hmm, have you setup your TC countries with a 'Region Code' of
en-GB
? It should be a two letter country code really, so just GB as en-GB is a language reference rather than a country reference.PS A different error means we are making progress so don't worry, we will get there 👍
Well, well, well - would you look at that!
I didn't set this site up (at least, not TC). Also, I haven't changed anything so it was either working or being ignored previously. I've changed it to GB.
So, now to make a coffee and make sure all the working bits are all in the right place, so I don't lose them!!
🎉Wh00p Wh00p! 🎉
Now that's a wonderful sight to see 😁
Erm, not sure whether I should post here or here https://our.umbraco.com/packages/website-utilities/tea-commerce/tea-commerce-support/97338-basket-not-cleared-after-stripe-payment
I've noticed that the basket does not clear after an order is paid for / completed - as previously noticed in the above post.
I had added the following to the "Order_Finalized" call (NotificationCenter.Order.Finalized):
Do you have any kind of caching or something in place as you are the only person I've seen have this issue. 🤔
I upgraded to the latest version of TeaCommerce, 3.3.1, from 3.3.0. I made no other changes to code (except for the payment page as above).
I have just debugged the code locally and the "NotificationCenter.Order.Finalized" routine is called. No errors happen and it runs the "RemoveCurrentOrder" line of code, above.
The basket used to empty before upgrading and implementing the new Stripe provider, now it doesn't. It does still work (the basket clears) on our Staging website, which is running TeaCommerce 3.3.0 and the previous Stripe payment processor.
Are you saying the
TC.RemoveCurrentOrder
method call isn't clearing the basket either?The only thing that was introduced in 3.3.1 regarding the saving of orders was that it's now wrapped in a transaction, but can't see how that would cause this.
I debugged the app (Visual Studio 2017) to check that the "Finalized" code is called.
ApplicationStarted:
Order_Finalized:
I added the "var r = " bit so that I could see what it returned (null). immediately after the call, "order" still seems to be populated with the same values.
Internally
TC.RemoveCurrentOrder
doesn't actually cause a save anyway, all it ever does it get the order and then clears cookie / session variables.Do you have TC configured to use cookies for the site? (in the store settings)
I assume the basket should be cleared automatically, without having to add extra code? Could the TC code be upset by me having code that references the "order" during the "Order_Finalized" routine?
Ok, can I check, on your Stripe payment form, what is it set to submit to? it should be set to
action="@Request.Form["continue_url"]"
Essentially, when you hit this continue URL, this will post to TC which will set the current order to be the current finalized order in the session controller and also removes it as the current order and THEN redirects to the confirmation page URL.
I am wondering, if rather than submitting to TCs continue URL, it is actually just being sent to the confirmation page, skipping the continue callback, thus skipping clearing the session.
"continue_url" is set to "/en/store/cart-content/confirmation/" - are you saying it should be set to something else?
No, I was wondering if you'd hard coded the form to be
action="/en/store/cart-content/confirmation/"
not knowing thatRequest.Form["continue_url"]
isn't just a straight reference to that setting.Damn it! I was really hoping that was it as I really don't know why it's not clearing it then.
So, can you think of anything I could be doing in my code that could stop the TC code from clearing the basket, after the order has been placed?
Honestly, no. I've exhausted everything I can think of. Only thing I can suggest now is to send over a complete backup of your site (removing any sensitive information) and I'll just have to try and replicate it and see what's going on.
I have emailed you regarding this.
is working on a reply...