LogicAppUnit / TestingFramework

Unit testing framework for Azure Logic Apps (Standard)
MIT License
24 stars 12 forks source link

CallAzureFunctionEndpoint returns 'No such host is known.' #34

Open duvet86 opened 5 months ago

duvet86 commented 5 months ago

Hi and thanks for the awesome library. I am trying to test a workflow that calls a function app:

"Update_Clients": {
  "type": "Function",
  "inputs": {
    "method": "POST",
    "body": {
      "apiPath": "@parameters(endpoint')",
      "entity": "@body('Transform_JSON_To_JSON')"
    },
    "function": {
      "connectionName": "postEntity"
    }
  },
  "runAfter": {
    "Transform_JSON_To_JSON": ["SUCCEEDED"]
  }
},

I am mocking the external url like so:

{
"workflow": {
  "externalApiUrlsToMock": [
    "https://functionappname.azurewebsites.net"
  ]
}

But I am unsuccessful.

[2024-04-16T05:46:47.692Z] Executing 'Functions.WorkflowDispatcher' (Reason='(null)', Id=8fb43413-7e49-412c-bcb8-d51ef980954a)
[2024-04-16T05:46:47.784Z] Outgoing HTTP request ends with server failure: correlationId='8e89da72-994d-40c4-8449-48dc4dae33a5', operationName='CallAzureFunctionEndpoint', httpMethod='POST', hostName='functionappname.azurewebsites.net', targetUri='https://functionappname.azurewebsites.net:443/api/Post?Code=*sanitized*', clientRequestId='32a8029e-41a9-4442-8b6b-660eaa383935', clientSessionId='', clientApplicationId='', apiVersion='', contentLength='-1', serviceRequestId='', durationInMilliseconds='68', httpStatusCode='0', exceptionMessage='System.Net.Sockets.SocketException (11001): No such host is known.
[2024-04-16T05:46:47.784Z]    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
[2024-04-16T05:46:47.785Z]    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
[2024-04-16T05:46:47.785Z]    at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
[2024-04-16T05:46:47.785Z]    at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)', errorCode='', errorMessage='', referer='<null>', failureCause='', contentType='', contentEncoding='', armServiceRequestId='', organizationId='', activityVector='IN.04', locale='en-US', additionalProperties='{"ParentActivityId":"00-075c8d37f7630662d86b485b2b6443ca-6f4587e233d41965-00"}', targetResourceProvider='', targetResourceType='', extensionVersion='1.62.30.0', siteName='UNDEFINED_SITE_NAME', slotName='', activityId='32a8029e-41a9-4442-8b6b-660eaa383935'.
[2024-04-16T05:46:47.839Z] Executed 'Functions.WorkflowDispatcher' (Succeeded, Id=8fb43413-7e49-412c-bcb8-d51ef980954a, Duration=147ms)