#Cloud Code Module Missing (cold starts)
1 messages · Page 1 of 1 (latest)
no i created this a week or 2 ago
ive been using the same one
and every cold start im getting this error
And so when you retry it works?
yup
i dont know if this is the right place to put it but in my Setup function for ICloudCodeConfig im setting up a database reference
im not making any connections or awaiting it so idk if that has anything to do with it
Can you share the code?
public class ModuleConfig : ICloudCodeSetup
{
public void Setup(ICloudCodeConfig config)
{
var url = "---";
var key = "---";
var options = new SupabaseOptions
{
AutoConnectRealtime = true,
AutoRefreshToken = true,
};
var supabase = new Client(url, key, options);
SupabaseClient.Init(supabase); //im just storing the reference here
config.Dependencies.AddSingleton(GameApiClient.Create());
}
}
sorry it came out messy
public class SupabaseClient
{
private static Client _client;
public static Client Client { get => _client; }
public static void Init(Client client)
{
_client = client;
}
}
``` for reference
And when you check your logs you're not seeing any errors that would line up with the missing module request?
logs are empty
Hmm, not too much to go on here, @trim totem or @scarlet vapor you guys have any ideas?
How do you validate that your call is using the correct environment & module name?
so im not sure about enviornment because i dont remember seeing anythign about that in the docs but the module name goes in the uri
this is my full response
{
"type":"problems/invocation",
"title":"Unprocessable Entity",
"status":422,
"detail":"Invocation Error",
"instance":null,
"code":9009,
"details":[
{
"message":"Module with the name Player was not found. Ensure that it is published to Cloud Code for the correct environment",
"name":"ScriptRunner.Exceptions.ModuleNotFoundException",
"stackTrace":[
]
}
]
}
this is from the rest api
You can tell your environment id by looking at your access token and decoding with any jwt decoder
oh yea, its using the right one
ill double check
so im getting it from https://services.api.unity.com/auth/v1/token-exchange?projectId=---&environmentId=--- so i know the enviornment id is right
and the request works fine the second time, just not on cold start
ive just double checked in the dashboard too, ids are correct
I see, I'll let others chime in on the cold start readiness then if its not a configuration issue
ok thanks!
We are aware that the cold starts for Cloud Code C# can be annoying and are looking to reduce the impact of it. In the meantime I'd suggest implementing a retry attempt on 422. This should only happen if Cloud Code receives no traffic from your game for 15 minutes.
ive got that set up already so its not a huge issue but as far as i remember, 422 is used for some other things. can you tell me if code 9009 in the response is what i should really be looking for?
also wanted to add im getting request timeouts for 10+ seconds sometimes. you probably got that one down too because i see people on the forums are having that issue too