hello-world = (404) HTTP/1.1 404 Not Found

Hi,
I am following the Get Started with UGS Cloud Code tutorial. I get the "404 Not Found" error and have been trying to solve it but with no success. I am authorised before I execute the Cloud Code function.

Anyone that can help would be appreciated.

NotFound
(404) HTTP/1.1 404 Not Found
Error
Script could not be found

UnityEngine.Debug:LogError (object)
Unity.Services.CloudCode.CloudCodeInternal:BuildException (bool,long,int,string,Unity.Services.CloudCode.Internal.Http.HttpException) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/CloudCode.cs:181)
Unity.Services.CloudCode.CloudCodeInternal/<GetRunScriptResponse>d__15:MoveNext () (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/CloudCode.cs:111)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.CloudCode.Internal.Response`1<Unity.Services.CloudCode.Internal.Models.RunScriptResponse>>:SetException (System.Exception)
Unity.Services.CloudCode.CloudCodeInternal/<GetResponseAsync>d__20:MoveNext () (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/CloudCode.cs:234)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.CloudCode.Internal.Response`1<Unity.Services.CloudCode.Internal.Models.RunScriptResponse>>:SetException (System.Exception)
Unity.Services.CloudCode.Internal.Apis.CloudCode.CloudCodeApiClient/<RunScriptAsync>d__8:MoveNext () (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Apis/CloudCodeApi.cs:167)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.CloudCode.Internal.Http.HttpClientResponse>:SetResult (Unity.Services.CloudCode.Internal.Http.HttpClientResponse)
Unity.Services.CloudCode.Internal.Http.HttpClient/<MakeRequestAsync>d__2:MoveNext () (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Http/HttpClient.cs:44)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.CloudCode.Internal.Http.HttpClientResponse>:SetResult (Unity.Services.CloudCode.Internal.Http.HttpClientResponse)
Unity.Services.CloudCode.Internal.Http.HttpClient/<CreateWebRequestAsync>d__4:MoveNext () (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Http/HttpClient.cs:69)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.CloudCode.Internal.Http.HttpClientResponse>:SetResult (Unity.Services.CloudCode.Internal.Http.HttpClientResponse)
Unity.Services.CloudCode.Internal.Http.HttpClient/<CreateHttpClientResponse>d__6:MoveNext () (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Http/HttpClient.cs:105)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.CloudCode.Internal.Http.HttpClientResponse>:SetResult (Unity.Services.CloudCode.Internal.Http.HttpClientResponse)
Unity.Services.CloudCode.Internal.Http.HttpClient/<>c__DisplayClass6_0/<<CreateHttpClientResponse>b__0>d:MoveNext () (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Http/HttpClient.cs:102)
System.Threading.Tasks.TaskCompletionSource`1<Unity.Services.CloudCode.Internal.Http.HttpClientResponse>:SetResult (Unity.Services.CloudCode.Internal.Http.HttpClientResponse)
Unity.Services.CloudCode.Internal.Http.UnityWebRequestHelpers/<>c__DisplayClass0_0:<GetAwaiter>b__0 (UnityEngine.AsyncOperation) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Http/UnityWebRequestHelpers.cs:34)
UnityEngine.AsyncOperation:InvokeCompletionEvent () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/AsyncOperation.cs:21)
HttpException`1: (404) HTTP/1.1 404 Not Found
Unity.Services.CloudCode.Internal.Http.ResponseHandler.HandleAsyncResponse (Unity.Services.CloudCode.Internal.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Http/ResponseHandler.cs:122)
Unity.Services.CloudCode.Internal.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.CloudCode.Internal.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Http/ResponseHandler.cs:226)
Unity.Services.CloudCode.Internal.Apis.CloudCode.CloudCodeApiClient.RunScriptAsync (Unity.Services.CloudCode.Internal.CloudCode.RunScriptRequest request, Unity.Services.CloudCode.Internal.Configuration operationConfiguration) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/com.unity.services.cloudcode.internal/Apis/CloudCodeApi.cs:166)
Unity.Services.CloudCode.CloudCodeInternal.GetResponseAsync (System.String function, System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/CloudCode.cs:234)
Unity.Services.CloudCode.CloudCodeInternal.GetRunScriptResponse (System.String function, System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/CloudCode.cs:107)
Rethrow as CloudCodeException: NotFound
(404) HTTP/1.1 404 Not Found
Error
Script could not be found
Unity.Services.CloudCode.CloudCodeInternal.GetRunScriptResponse (System.String function, System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/CloudCode.cs:111)
Unity.Services.CloudCode.CloudCodeInternal.CallEndpointAsync[TResult] (System.String function, System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at ./Library/PackageCache/com.unity.services.cloudcode@2.5.1/Runtime/CloudCode.cs:45)
Manager.BTN_Run () (at Assets/Manager.cs:93)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <58ad0307846e4e2aa7b395ea5a7758f5>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

9739270--1393105--Screenshot 2024-03-30 at 10.43.35.png

9739270--1393108--Screenshot 2024-03-30 at 10.43.52.png

CODE:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using Unity.Services.Authentication;
using Unity.Services.Core;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using Unity.Services.CloudCode;



public class Manager : MonoBehaviour
{
    public Image img_Status;
    public TMP_Text txt_Log;


    /*
     * CloudCodeResponse represents the response from the script, used for deserialization.
     * In this example, the script returns a JSON in the format
     * {"welcomeMessage": "Hello, arguments['name']. Welcome to Cloud Code!"}
     */
    class CloudCodeResponse
    {
        public string welcomeMessage;
    }

    /*
     * Initialize all Unity Services and Sign In an anonymous player.
     * You can perform this operation in a more centralized spot in your project
     */
    private async void Awake()
    {
        img_Status.color = Color.red;
        txt_Log.text += ">> START <<\n";

        {
            try
            {
                await UnityServices.InitializeAsync();
            }
            catch (Exception e)
            {
                txt_Log.text += "Exception: " + e + "\n";
                img_Status.color = Color.red;
            }
        }


        await SignInAnonymouslyAsync();
    }


    async Task SignInAnonymouslyAsync()
    {
        try
        {
            await AuthenticationService.Instance.SignInAnonymouslyAsync();
            Debug.Log("Sign in anonymously succeeded!\n");

            // Shows how to get the playerID
            txt_Log.text += "LOGIN SUCCESSFUL\n";
            txt_Log.text += "PlayerID: " + AuthenticationService.Instance.PlayerId + "\n";
            txt_Log.text += "----------------------------------\n";
            img_Status.color = Color.green;

        }
        catch (AuthenticationException ex)
        {
            // Compare error code to AuthenticationErrorCodes
            // Notify the player with the proper error message
            txt_Log.text += "AuthenticationException: " + ex + "\n";
            img_Status.color = Color.red;
        }
        catch (RequestFailedException ex)
        {
            // Compare error code to CommonErrorCodes
            // Notify the player with the proper error message
            txt_Log.text += "RequestFailedException: " + ex + "\n";
            img_Status.color = Color.red;
        }
    }

    /*
     * Populate a Dictionary<string,object> with the arguments and invoke the script.
     * Deserialize the response into a CloudCodeResponse object
     */
    public async void BTN_Run()
    {
        var arguments = new Dictionary<string, object> { { "name", "UNITY" } };
        var response = await CloudCodeService.Instance.CallEndpointAsync<CloudCodeResponse>("hello-world", arguments);
    }
}

Hi. I'm sure you've already linked your Unity project with this specific cloud project "UGS_Test_Platform"?

1 Like


Oh my ... I mixed the names. Thank you vey much, now it works.

1 Like