ruast
March 2, 2022, 12:55pm
1
My App Connect API Form is running the API on pressing submit button and my server (Azure Functions) logs show that everything worked as expecte d , but in Wappler the Done event is only firing for some functions. Is there some kind of time limit within which response has to be received because the <1sec are firing the done event correctly but the ~3sec ones are not
Thanks
ruast
March 2, 2022, 4:43pm
2
Feels like a bug in the client side API Done Event
It seems to fire reliably for all codes between 400 to 500 and but never fires for codes in the 200 series ( like 200 , 201 , 202…)
Please let me know if i am doing something wrong or if this is a bug and if there are any workaround Thanks
public static class Function1
{
[FunctionName("Function1")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string name = req.Query["name"];
log.LogInformation( name);
switch(name)
{
case "200":
return (ActionResult) new StatusCodeResult(200);
case "201":
return (ActionResult)new StatusCodeResult(201);
case "202":
return (ActionResult)new StatusCodeResult(202);
case "210":
return (ActionResult)new StatusCodeResult(210);
case "211":
return (ActionResult)new StatusCodeResult(211);
case "212":
return (ActionResult)new StatusCodeResult(212);
case "220":
return (ActionResult)new StatusCodeResult(220);
case "250":
return (ActionResult)new StatusCodeResult(250);
case "400":
return (ActionResult)new StatusCodeResult(400);
case "410":
return (ActionResult)new StatusCodeResult(410);
case "411":
return (ActionResult)new StatusCodeResult(411);
case "412":
return (ActionResult)new StatusCodeResult(412);
case "420":
return (ActionResult)new StatusCodeResult(420);
case "421":
return (ActionResult)new StatusCodeResult(421);
case "501":
return (ActionResult)new StatusCodeResult(501);
case "502":
return (ActionResult)new StatusCodeResult(502);
default:
return (ActionResult)new StatusCodeResult(550);
}
}
}
}
I tried the above API to find this out
Form Code is
<form id="form1" is="dmx-api-form" action="https://xxx.azurewebsites.net/api/
Function1?code=IAx6SnN0/XnfwxQARnOQnh1A=="
dmx-on:done="run({alert:{message:`form1.status +\'status\'`}})"
name="name.value">
<input id="name" name="name" type="text" class="form-control">
<button id="btn2" class="btn" type="submit">Button</button>
</form>
Edited to Add, that There is the same problem with Success Event too
ruast
March 2, 2022, 6:03pm
3
For Codes in the 200 series
the following works
case "210":
return new ObjectResult("this works") { StatusCode = 210 };
and the following do not work
case "210":
return (ActionResult)new StatusCodeResult(210);
case "210":
return new StatusCodeResult(210);
For Codes in the series 400-599 all of the above work