Maybe I am missing something fundamental about pocket-ic or the http gateway functionality but I am struggling to figure out how to get an update call to process (queries are fine) using the HttpGateway functionality in pocket-ic
Here is an example that I am running that uses the counter wasm canister and calls ‘inc’, but on that call it waits indefinately because there is no request_status for the request in the state
I tried to play around with time/ticks with manually setting and doing auto_progress but have had no luck
I am currently implementing a .NET client for pocket-ic, so there is a good chance there is a bug on my end but I am kinda stuck and could use some direction. Any help would be appreciated
That test isn’t http gateway specific and the other http gateway tests, i dont see anything relevant to what im trying to do with update call + http gateway
I see more relevant things in the pocket_ic_server tests like
but dont see any update call processing unfortunately
Thanks for the example but im still struggling to find the issue
Any advice on how i should be debugging this?
Something I can see on the server end?
What makes/doesn’t make the update calls get processed via http gateway?
I am doing the same setup for the canister as direct calls for the http gateway calls, but only the http gateway blocks/hangs on processing the update calls
This is the only runtime/error logs i get from the server:
2
Nov 25 18:51:52.219 WARN s:/n:/ic_state_manager/ic_state_manager No state available with certification.
Nov 25 18:51:52.220 WARN s:/n:/ic_query_stats/payload_builder Current stats are uninitalized. This warning should go away after some minutes if the replica is processing query calls.
Nov 25 18:51:52.221 WARN s:/n:/ic_query_stats/payload_builder Current stats are uninitalized. This warning should go away after some minutes if the replica is processing query calls.
This log line means that the HTTP request to /instances/0/api/v3/canister/7tjcv-pp777-77776-qaaaa-cai/call finished and returned a response: this response has the form specified here. So I’m not sure what you mean by “just sits there till it times out”.
The update http request times out with V3 and i don’t get a completed response for V2. Query requests are just fine though
Could the pocketic server finish the uodate, but the http gateway fail to respond?
When i do dfx canister call to it without --async i get a weird message that the cert is stale over 240s, which doesn’t seem to make sense because I have confirmed my times are in sync and i dont wait that long
BUT
I am able to do --async, get a ‘Request Id’ back, then try to wait on that response. It gives the same results of getting a ‘request status’ type of null indefinately. no ‘received’, ‘processing’, etc…, as i do with doing it with code (vs CLI)
Does this mean that the request can’t be found?
I currently DO have ‘auto progress’ or manual time inc running for this in my code, but does the request need time to progress to finish? (that being said, it seems like from the logs its finishing)
I feel decently confident that my client code for these http requests is good because that code has existed for a while (using both v2 and v3), it seems like im just having an issue getting the request to appear in the http gateway or something
Im not sure what you are looking for with ‘create an instance’. I start the server as shown before, then use the api to create an instance with my created client method
Then this is how it is run.
I never set the time, but I am trying now with no change
await using (PocketIc pocketIc = await PocketIc.CreateAsync(this.url, nnsSubnet: nnsSubnet))
{
Principal canisterId = await pocketIc.CreateAndInstallCanisterAsync(wasmModule, arg);
await pocketIc.StartCanisterAsync(canisterId);
await pocketIc.SetTimeAsync(ICTimestamp.Now()); // Just added. Set time?
// Let time progress so that update calls get processed
await using (await pocketIc.AutoProgressTimeAsync())
{
await using (HttpGateway httpGateway = await pocketIc.RunHttpGatewayAsync())
{
Here is a link to the example code that I am trying
Maybe if I better understood some of these concepts or what is required/different about the HttpGateway vs just a direct pocketic call
Remember that the direct pocketic calls work, its just the HttpGateway
Is there a way to set the time or something with the HttpGateway and that is throwing it off and rejecting requests/responses? Because it doesnt seem like it recognizes the request id for some reason
Could you please try again with dfx now that you set the time to the current timestamp?
what is required/different about the HttpGateway vs just a direct pocketic call
if you make an update call via the HTTP gateway, then you need to set all required fields according to the Interface Specification including authentication envelope and satisfying certain properties (valid signatures, ingress expiry not in the past and not more than 5 minutes into the future w.r.t. both current time and PocketIC time - this might be unsatisfiable if the PocketIC time is much off the current time) whereas if you make an update call via the path /instances/0/update/execute_ingress_message, then stuff like signatures and ingress expiry can be omitted.
I could reproduce the issue with dfx if I only call auto_progress without setting time to the current time explicitly before. I’ll try to make PocketIC fail with a helpful error message in this case.
dfx call WITH --async, i get a request id back, but cant get the status via code
dfx call WITHOUT --async, i now DOES work, and I can do a follow-up query call and see that ‘inc’ was executed
V3 Code call, i get back an ‘accepted’ response, then i have to poll for the request, which it then times out (note: never had a time sync error with the code, this how it always responded)
V2 Code call, it just polls with a null ‘request type’ until it times out
Inspecting the http call, it sends all the proper information, including an up to date ingress_expiry
But again, this Http Client has been around for a while and haven’t had any issues with it
I dont need you to debug or figure out whats wrong with my code. Im just trying to figure out the situation in which the Http Gateway would not show a request being processed, or how i could check anything on the http gateway side of things to understand if my code is doing something incorrect. If this was an issue with the time sync/spec issue it should be fixed and/or i should see some sort of error response, but its just not there like its not being processed, even though we saw some activity in the logs