• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by thef006 · Feb 05 at 07:10 PM · errorerror messagewebrequestcertificatessl

UnityWebRequests constantly fail with 'SSL CA certificate error' on the HoloLens 2 device (UWP build) when accessing API hosted on Azure

Question

Am I missing something obvious, or should I submit an issue?


Description

When trying to communicate with an API hosted on Azure (.NET based) the requests work well in the Unity Editor, but, when deployed on device (HoloLens 2), the requests fail with the error message mentioned in the title. The return code is 0, the result is a ConnectionError and the error message is 'SSL CA certificate error'.


Additional info

I have also made empty projects to verify that this is not an issue with my code and:

  • On Unity 2019.4.32f1. the requests work just fine.

  • On Unity 2020.3.25f1 and 2020.3.27f1 (which is the version I was primarily using), the requests always fail.

    What I've also tried:

  • Adding a custom CertificateHandler which accepts all certificates and including it in the UnityWebRequest object. I have also verified with debugging that the return statement is called in the custom handler, but this did not help with the issue.

  • Adding a callback to the System.Net.ServicePointManager.ServerCertificateValidationCallback, again accepting all certificates.

  • Different types of requests (POST, GET) - all end up with the same error.

  • Updating the device and Visual Studio dependencies (SDKs).

Additional notes:

  • I'm not able to share the URL of the Azure backend that I'm using.

  • The site's certificate is valid. The API can be opened and inspected through the Edge browser, on the HoloLens 2 device. I have also used other tools to verify this (e.g. https://dnschecker.org/ssl-certificate-examination.php).

  • The project settings in the different Unity versions used to verify the issue are absolutely the same. Same scripting backend, same API compatibility...

  • Might be related to the following forum post as the last comment (from mentalup, on Jan 10, 2022) is from a few weeks ago and mentions a similar issue: https://forum.unity.com/threads/unitywebrequest-report-an-error-ssl-ca-certificate-error.617521/

  • Other requests e.g. to https://google.com work just fine


    Code Sample

Sample code that I used to check the requests:

 private IEnumerator Test() {
         var unityWebRequest = new UnityWebRequest(
             url,
             UnityWebRequest.kHttpVerbPOST);
     
         unityWebRequest.SetRequestHeader("Content-Type", "application/json");
         unityWebRequest.SetRequestHeader(apiHeaderName, apiHeaderValue);
     
         unityWebRequest.downloadHandler = new DownloadHandlerBuffer();
     
         unityWebRequest.uploadHandler =
             new UploadHandlerRaw(Encoding.UTF8.GetBytes(body));
         unityWebRequest.uploadHandler.contentType = "application/json";
     
         yield return unityWebRequest.SendWebRequest();
         
         var error = unityWebRequest.error;
     }



Update 2022-02-06

  • Same requests work on Android builds (on device) on 2020.3.25f1 (presumably on 27f1 too).

  • I tried pinging a random azurewebsites site different than the one I'm using and the same issue persists on the HoloLens 2 device. The URL I pinged was https://coms.azurewebsites.net/SystemAdministration/Login (first site that popped up on the search engine).


    Update 2022-02-09

  • Also tried adding the mscorlib (where it seems the issue comes from) to the link.xml assemblies that are ignored by the IL2CPP code stripping. No luck with that either.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by thef006 · Feb 11 at 10:16 PM

Turned out it was a Unity bug and it has been fixed in Unity 2020.3.28f1 and some other patch versions. The issue mentioned in the release notes is a bit different, but I assume it's the same one that solved the one from this question: https://issuetracker.unity3d.com/issues/tlsexception-handshake-failed-error-when-uwp-build-configuration-is-set-to-release

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image unity_468EA0230C8F329D08FB · Feb 17 at 08:52 PM 1
Share

I was having the same error using Unity 2020.3.24f1 for a UWP ARM64 Build for the HoloLens 2, against a CCD bucket. My initial solution was to move to a AWS S3 (publicly open) and replace the request's uri HTTPS to HTTP.

I updated to 2020.3.28f1 and my CCD requests now work on the device.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

179 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_EXPIRED SSL CA certificate error 1 Answer

The type or namespace "Target" could not be found? 1 Answer

Can't download assets in unity asset store 0 Answers

Keep getting this error message,Hi whenever i open the editor i keep getting this error. 0 Answers

How can I add a certificate to the Mono Trust store? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges