Error:
HttpException: (403) HTTP/1.1 403 Forbidden
Unity.Services.CloudCode.Internal.Http.ResponseHandler.HandleAsyncResponse (Unity.Services.CloudCode.Internal.Http.HttpClientResponse response, System.Collections.Generic.Dictionary2[TKey,TValue] statusCodeToTypeMap) (at ./Library/PackageCache/com.unity.services.cloudcode@49bc6c02e205/Runtime/com.unity.services.cloudcode.internal/Http/ResponseHandler.cs:120)
Unity.Services.CloudCode.Internal.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.CloudCode.Internal.Http.HttpClientResponse response, System.Collections.Generic.Dictionary2[TKey,TValue] statusCodeToTypeMap) (at ./Library/PackageCache/com.unity.services.cloudcode@49bc6c02e205/Runtime/com.unity.services.cloudcode.internal/Http/ResponseHandler.cs:226)
Unity.Services.CloudCode.Internal.Apis.CloudCode.CloudCodeApiClient.RunModuleAsync (Unity.Services.CloudCode.Internal.CloudCode.RunModuleRequest request, Unity.Services.CloudCode.Internal.Configuration operationConfiguration) (at ./Library/PackageCache/com.unity.services.cloudcode@49bc6c02e205/Runtime/com.unity.services.cloudcode.internal/Apis/CloudCodeApi.cs:138)
Unity.Services.CloudCode.CloudCodeInternal.GetModuleResponseAsync (System.String module, System.String function, System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at
#Hi, I am trying to integrate cloud code functions but getting error 403 while doing so, I have alrea
1 messages · Page 1 of 1 (latest)
./Library/PackageCache/com.unity.services.cloudcode@49bc6c02e205/Runtime/CloudCode.cs:243)
Unity.Services.CloudCode.CloudCodeInternal.GetRunModuleScriptResponse (System.String module, System.String function, System.Collections.Generic.Dictionary2[TKey,TValue] args) (at ./Library/PackageCache/com.unity.services.cloudcode@49bc6c02e205/Runtime/CloudCode.cs:137)
Rethrow as CloudCodeException: Unknown
HTTP/1.1 403 Forbidden
Unity.Services.CloudCode.CloudCodeInternal.GetRunModuleScriptResponse (System.String module, System.String function, System.Collections.Generic.Dictionary2[TKey,TValue] args) (at ./Library/PackageCache/com.unity.services.cloudcode@49bc6c02e205/Runtime/CloudCode.cs:153)
Unity.Services.CloudCode.CloudCodeInternal.CallModuleEndpointAsync[TResult] (System.String module, System.String function, System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at ./Library/PackageCache/com.unity.services.cloudcode@49bc6c02e205/Runtime/CloudCode.cs:60)
Unity.Services.CloudCode.GeneratedBindings.ELUserDetailsModuleBindings.GetUserData () (at Assets/CloudCode/GeneratedModuleBindings/ElebendCloud/ELUserDetailsModuleBindings.cs:39)
Elebend.Managers.ELCloudDataManager.Refresh () (at Assets/Elebend/Scripts/Managers/ELCloudDataManager.cs:20)
Elebend.UI.Screen.ELTitleScreen.<InitializeUgs>gPlayerSignedIn|12_0 (System.Boolean success, System.String message) (at Assets/Elebend/Scripts/UI/Screen/ELTitleScreen.cs:86)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b7_0 (System.Object state) (at <1eb9db207454431c84a47bcd81e79c37>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <07c12a9d8ce247d18a35c5e3e7bb065f>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <07c12a9d8ce247d18a35c5e3e7bb065f>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <07c12a9d8ce247d18a35c5e3e7bb065f>:0)
Client code
using System.Collections.Generic;
using System.Threading.Tasks;
using Elebend.Utility.Log;
using Unity.Services.CloudCode;
using Unity.Services.CloudCode.GeneratedBindings;
using Unity.Services.CloudCode.GeneratedBindings.ElebendShared;
using Unity.Services.CloudSave;
namespace Elebend.Managers
{
public class ELCloudDataManager : ELSingletonMonoBehavior<ELCloudDataManager>
{
public ELUserData UserData { get; private set; }
private ELUserDetailsModuleBindings _userDetailsBindings;
public async Task Refresh()
{
_userDetailsBindings = new ELUserDetailsModuleBindings(CloudCodeService.Instance);
UserData = await _userDetailsBindings.GetUserData();
}
public async Task ChangeUserName(string newUserName)
{
await _userDetailsBindings.ChangeUserName(newUserName);
await Refresh();
}
private async Task<T> RetrieveSpecificData<T>(string key)
{
try
{
var results = await CloudSaveService.Instance.Data.Player.LoadAsync(
new HashSet<string> { key }
);
if (results.TryGetValue(key, out var item))
{
return item.Value.GetAs<T>();
}
ELLog.Log(ELLogCategory.Cloud, $"There is no such key as {key}!");
}
catch (CloudSaveValidationException e)
{
ELLog.LogError(ELLogCategory.Cloud, e);
}
catch (CloudSaveRateLimitedException e)
{
ELLog.LogError(ELLogCategory.Cloud, e);
}
catch (CloudSaveException e)
{
ELLog.LogError(ELLogCategory.Cloud, e);
}
return default;
}
}
}
Server code:
- My user is properly authenticated
- I am using cloud code binding and modules to call the code
- The environment is correct : development
- Tried login with both annonymus and google
- Does not have service accounts
- The C# module are correctly deployed to the server and visible on the unity cloud dashboard
Are you manually settihg the environment in code? I believe that it defaults to production when you initialize Unity Services and it's not specified
https://docs.unity.com/ugs/en-us/manual/overview/manual/service-environments#accessing-environments-within-unity-projects
yes I am manually setting the enviornment
also I have a function that gets executed post sign up automatically using triggers
and that function is working fine
I deleted the enviornment and created it again and volla it works