Nest не может записать в ES при выполнении из функций Azure - PullRequest
0 голосов
/ 31 января 2019

У меня есть функция Azure, которая прослушивает события и записывает данные в ES, но случайным образом не работает.

Exception while executing function: ElasticSearchIndexer Invalid NEST response built from a unsuccessful low level call on POST: /_bulk
 # Invalid Bulk items:
 # Audit trail of this API call:
 - [1] AllNodesDead: Took: 00:00:00
 - [2] Resurrection: Node: http://ip:9200/ Took: 00:00:00
 - [3] PingFailure: Node: http://ip:9200/ Exception: PipelineException Took: 00:00:02.0095670
 # OriginalException: Elasticsearch.Net.ElasticsearchClientException: Failed to ping the specified node.. Call: Status code unknown from: HEAD / ---> Elasticsearch.Net.PipelineException: Failed to ping the specified node. ---> Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node. ---> System.Net.WebException: The request was aborted: The request was canceled.
 at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
 at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
 --- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Elasticsearch.Net.HttpWebRequestConnection.<RequestAsync>d__5`1.MoveNext()
 --- End of inner exception stack trace ---
 at Elasticsearch.Net.RequestPipeline.<PingAsync>d__65.MoveNext()
 --- End of inner exception stack trace ---
 at Elasticsearch.Net.RequestPipeline.<PingAsync>d__65.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Elasticsearch.Net.Transport`1.<PingAsync>d__21.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Elasticsearch.Net.Transport`1.<PingAsync>d__21.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Elasticsearch.Net.Transport`1.<RequestAsync>d__15`1.MoveNext()
 --- End of inner exception stack trace ---
 # Audit exception in step 3 PingFailure:
 Elasticsearch.Net.PipelineException: An error occurred trying to read the response from the specified node. ---> System.Net.WebException: The request was aborted: The request was canceled.
 at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
 at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
 --- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Elasticsearch.Net.HttpWebRequestConnection.<RequestAsync>d__5`1.MoveNext()
 --- End of inner exception stack trace ---
 at Elasticsearch.Net.RequestPipeline.<PingAsync>d__65.MoveNext()
 # Request:
 <Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>
 # Response:
 <Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.>

Я регистрируюсь в DI.

            var uris = FlymarkAppSettings.Instance.ElasticServerConnection.Split(';').Select(url => new Uri(url));
            var settings = new ConnectionSettings(new StaticConnectionPool(uris));
#if DEBUG
            settings.EnableDebugMode();
#endif

            builder.Register(c => new ElasticClient(settings))
                .As<IElasticClient>()
                .SingleInstance();
...