Litium App Error: [The SSL connection could not be established, see inner exception.]

Hey!

When I try to add a config file to an application such as BriqPay locally I get this error:
[The SSL connection could not be established, see inner exception.]
I have seen this post as well: Litium App Direct Payment - The SSL connection could not be established, see inner exception

This exact problem has happened before. Currently trying to handle a project that gives all kinds of errors and the SSL connection is just one of them.

I have looked over an identical post but I don’t have much of a solution for it.

According to the post that already exists, the problem was due to the network mixing and mashing stuff with the docker internal link which then caused problems.

The other errors involved are that I cannot run the project locally like I did before because it will give me a “CERT_INVALID” error. It works on firefox but not on brave, this was not a problem before. I had to check with the certification as well and it has not expired.

Is there something I can do directly within docker to make sure that I won’t have to encounter this type of problem again, or at the very least something that I can do to fix this for the moment?

Thanks in advance for any type of info you guys can give me.

Regards, Karwan!

If it works with Firefox/Chrome/Edge it should as well work with Brave and is not the container running inside docker that is the problem but the browser.

Firefox have some additional settings that may need to be set, see Enforce HTTPS in ASP.NET Core | Microsoft Learn, so that will trust the certificate. Chrome/Edge on Windows is using the certificate store on the local computer. How Brave handle certificates is out of my knowledge but it may be that they need some extra settings like the one that is needed for Firefox.

I see. I have followed the instructions as described in the docs regarding setting those additional settings in Firefox.

Unfortunately it didn’t make any difference. Also when I said it works I was referring to being able to visit the Backoffice and the website.

I still cannot add the correct configuration to the apps without getting the same error as before.

Also I get the same error on Chrome simply when I try to access the site:

Regards.

Try again to run the command dotnet dev-certs https --trust to see if that will be able to add the certificate into the trusted store.

Check that the certificate exists in the Trusted Root Certification Authorities under Manage user certificate

When running the command:

And the certification exists in Trusted Root Certification Authorities. It’s identical to the image.

I tried running that command beforehand as well but since it’s already trusted and it already existed I thought something else could be causing this issue.

Regards, Karwan.

Just to update: Still a problem for me.

I can still do my work currently but when I need apps to change locally then that might be a problem for me. Current I can only work on firefox.

Try to import the certificate that should be in project/data/https/localhost.pfx in all of these places.

Also leave the certificate in project/data/https, so the apps can use that.

And double check that the IIS is using that cert and that the password is correct when you do
dotnet dev-certs https -ep ./data/https/localhost.pfx -p SuperSecretPassword

I tried it, no difference.

Imported it serval times with the same issues. Made sure the password was correct across everything as well. The file already existed in the data/https as well.

When trying to run the command:
A valid HTTPS certificate is already present.

You can try to remove all 4 imported. And the one in data/https. Then do it all again to make sure all are from the same source.

After you done that, set it again in IIS.

1 Like

We have updated the guide for generate the https-certificate, see Custom developer certificate (litium.com)

Remember to remove re-export the new certificate for the containers before the contains need to be restarted so they will pick up the new certificate change.

This guide will use powershell to install the certificate and will only work on Windows, the part that covers generation of certificate will work on other OS as well but there the user need to find how/where the certificate should be installed. Old guide is linked from a note in the top.

1 Like

I ran the script and I can see the new certificate, I had to change one thing:

$sp = (ConvertTo-SecureString $s -AsPlainText -Force)

Added “-Force”. It wouldn’t work for me without it, was running the powershell as admin.

I still need the containers to update themselves to the new certificate but I’m not sure on how to do so.

Regards.

Thanks, I updated the script to include that as default.

You do the same as you was doing the first time when you was exporting the certificate, see Certiicate-section on Pre-built apps (litium.com), after the certificate is updated with the dotnet dev-certs command you need to restart the containers for the app so that is picking up the new certificate.

1 Like

Well the good news is that I can access my project on all browsers now and see the changes I make on all browers. No certificate issues at all on the browers.

But I still have the same SSL error when trying to give an app the correct json file.

And I cannot install a new app, this is what my error looks like when I try and install a new app:

What does the log file for Litium and the App say? Can the app start correctly and connect Litium after the app is installed?

If you not using the localtest.me domain, please, try to use that instead of what you currently using.

1 Like

I’m using the localtest.me.

My logs:

Litium.Web.Administration.WebApi.Settings.Controllers.AppManagementController - 
Could fetch app metadata 'https://customer-app-direct-payment.testcompany.localtest.me:44388/api/litium-app/metadata'. System.ArgumentException: 
Was not able to fetch app metadata from https://customer-app-direct-payment.testcompany.localtest.me:44388/api/litium-app/metadata
   at Litium.Application.AppManagement.AppManagementServiceImpl.GetMetadataAsync(String url)
   at Litium.Web.Administration.WebApi.Settings.Controllers.AppManagementController.InstallGet(String url)

When I try to install an app via my links from docker I get a security warning and after I get passed through I get the red banner in Litium saying:

image

Now when the ssl looks correct. Have you tried this:
## After update of docker desktop changing from 192.168.65.5 to 192.168.65.7 may be needed.

If you look in your docker-compose.yaml file. You have the dnsresolver. Try to change the 2 places that have 192.168.65.5 to 192.168.65.7. (Change 5 to 7).
And do a reset of the containers after.

2 Likes

That works.

Now I can install the apps and add the correct json files onto them.

I believe this would be the final issue:

Litium.Data.DataException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint

When I go to “Channel” → “thisCompany” → “Countries” I get that error when I try and add the Klarna app to it.

Could be that the database has the payment option, but the cache/site do not.

If you go into the database, look in table [Globalizations].[ChannelToCountryLinkPaymentOption]
If you see Klarna there, delete that row => Update redis cache prefix => Restart site => Now you should be able to add Klarna.

1 Like

Not sure what version of Litium you are running but in 8.7.1 we was fixing Bug 62594: Payment and shipping options is removed from channel (litium.com). If this is the issue you need to manual update the index-column in the following db-table to make it possible to update the entity again.
image

After applying the 8.7.1 or later this issue should not be introduced. If you was having the issue when you was upgrading, then the issue still will be there.

1 Like

I hear both of you. @Ericsj11 @patric.forsgard
Sorry for a little late response. I tried finding out where my local connection string was stored but could not find it. Is there a special location other than appsettings were a local connection string may be stored?

Regards.