#Cloud Code Module Missing (cold starts)

1 messages · Page 1 of 1 (latest)

thick flame
#

Is this just when you create a new module?

late stone
#

no i created this a week or 2 ago

#

ive been using the same one

#

and every cold start im getting this error

thick flame
#

And so when you retry it works?

late stone
#

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

thick flame
#

Can you share the code?

late stone
#
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
thick flame
#

And when you check your logs you're not seeing any errors that would line up with the missing module request?

late stone
#

logs are empty

thick flame
#

Hmm, not too much to go on here, @trim totem or @scarlet vapor you guys have any ideas?

thorny tiger
#

How do you validate that your call is using the correct environment & module name?

late stone
#

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

thorny tiger
#

You can tell your environment id by looking at your access token and decoding with any jwt decoder

late stone
#

oh yea, its using the right one

#

ill double check

#

and the request works fine the second time, just not on cold start

#

ive just double checked in the dashboard too, ids are correct

thorny tiger
#

I see, I'll let others chime in on the cold start readiness then if its not a configuration issue

late stone
#

ok thanks!

trim totem
#

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.

late stone
#

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