InvalidOperationException: Insecure connection not allowed -UnityWebRequestAsyncOperation

Only happens in some scenes with Needle 2.58.2-pre in Unity 2022.2.1f1, on attempting to hit the Play button on Export Info I get this error:

Original Post on Discord

by user 103054507105067008

InvalidOperationException: Insecure connection not allowed
β€”
System.InvalidOperationException: Insecure connection not allowed
UnityWebRequestAsyncOperation UnityEngine.Networking.UnityWebRequest.SendWebRequest()
async Task<bool> Needle.Engine.Utils.WebHelper.IsResponding(string url, CancellationToken cancel) in Library/PackageCache/com.needle.engine-exporter@2.58.2-pre/Common/Runtime/Utils/WebHelper.cs:31
async Task<bool> Needle.Engine.MenuItems+<>c__DisplayClass19_0.<StartDevelopmentServer>g__IsResponding|0(?)+IsResponding(?) in Library/PackageCache/com.needle.engine-exporter@2.58.2-pre/Core/Editor/Actions/MenuItems.cs:174
async void Needle.Engine.MenuItems.StartDevelopmentServer(IProjectInfo proj, bool startUsingIp, int level) in Library/PackageCache/com.needle.engine-exporter@2.58.2-pre/Core/Editor/Actions/MenuItems.cs:150
UnityWebRequestAsyncOperation UnityEngine.Networking.UnityWebRequest.SendWebRequest()
async Task<bool> Needle.Engine.Utils.WebHelper.IsResponding(string url, CancellationToken cancel) in Library/PackageCache/com.needle.engine-exporter@2.58.2-pre/Common/Runtime/Utils/WebHelper.cs:31
async Task<bool> Needle.Engine.MenuItems+<>c__DisplayClass19_0.<StartDevelopmentServer>g__IsResponding|0(?)+IsResponding(?) in Library/PackageCache/com.needle.engine-exporter@2.58.2-pre/Core/Editor/Actions/MenuItems.cs:174
async void Needle.Engine.MenuItems.StartDevelopmentServer(IProjectInfo proj, bool startUsingIp, int level) in Library/PackageCache/com.needle.engine-exporter@2.58.2-pre/Core/Editor/Actions/MenuItems.cs:150
void System.Runtime.CompilerServices.AsyncMethodBuilderCore.ThrowAsync(Exception exception, SynchronizationContext targetContext)+(object state) => { }
void UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke()
void UnityEngine.UnitySynchronizationContext.Exec()
void UnityEngine.UnitySynchronizationContext.ExecuteTasks()
β€”

by user 103054507105067008

Fixed by going to Edit > Project Settings > Player > Other Settings > Allow Downloads over http > change to Always Allowed. Might need to prompt some users on this though as I only knew to do this from an error with another plugin years back

by user 103054507105067008

Yes, I’ve seen this as well. We can guard against this. Seems that Unity complains about accessing the local server, well, locally

Think we need a β€œUnity Issue” label at some point :upside_down_face: