I have a problem with azure function only when I publish.
the code run not in order, all the functions run at the same time.
ex :
var logger = context.GetLogger(nameof(MibProposalRequest));
logger.Log(LogLevel.Warning, $"Début de la fonction : MibProposalRequest {DateTime.UtcNow}");
try
{
var getStringResponse = await this.GetStringAsync(req, logger).ConfigureAwait(false);
if (getStringResponse.Error != null)
{
return new HttpResponseMessage()
{
StatusCode = getStringResponse.Error.StatusCode,
ReasonPhrase = getStringResponse.Error.Message
};
}
else
{
var requestBody = getStringResponse.Response.ToString();
var deserializeRequestBodyResponse = await this.DeserializeRequestBodyAsync(requestBody, logger).ConfigureAwait(false);
if (deserializeRequestBodyResponse.Error != null)
{
return new HttpResponseMessage()
{
StatusCode = deserializeRequestBodyResponse.Error.StatusCode,
ReasonPhrase = deserializeRequestBodyResponse.Error.Message
};
}
In this example I need to get the response of the function GETStringAsync and after go to the function : DeserializeRequestBodyAsync.
If I run the azure function in local (debug) it's all ok, everything it's in order. First log the function start. After Get the string end deserializeObject.
But when I publish the function and I test it, when I'm loocking at the log in portal.azure. All the function run not in good order. So sometimes I get an error from deserializeObject function because no string to deserialize. But its suppose to do the GetStringAsync function first.
Why this append? Image of the log
as you can see the function start log is not the first to show up why ? looks like all the code run completely not in order.
should be like this : Log of vs debug
Everything is good each functions run in good order (so no problems)
Why this append only when the function is published ??
Ps: I tried to run the function not async but nothing change. PS2: I tried to put all the code in the same function (Run) nothing changed. PS3: I tried to put task.wait nothing changed.
I need help please 2 days I'm on this.