Я пытаюсь проверить, запросив GET в POSTMAN, чтобы проверить, получены данные или нет.Но показывая такие ошибки - PullRequest
0 голосов
/ 02 июня 2018

Ошибка почтальона.

Не удалось получить ответ. Произошла ошибка при подключении к http://108.59.80.67/elasticsearch/posts/post/_search?q=*. Почему это могло произойти: серверу не удалось отправить ответ: убедитесь, что сервер работаетСамозаверяющие SSL-сертификаты блокируются. Исправьте это, отключив «Проверка SSL-сертификата» в меню «Настройки»> «Общий прокси-сервер неправильно настроен». Убедитесь, что прокси-сервер правильно настроен в меню «Настройки»> «Тайм-аут запроса прокси-сервера: изменение времени ожидания запроса в меню« Настройки »>« Общие »

Ошибка Firebase

RequestError: Error: connect ETIMEDOUT 108.59.80.67:80
    at new RequestError (/user_code/node_modules/request-promise/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/user_code/node_modules/request-promise/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/user_code/node_modules/request-promise/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/user_code/node_modules/request/request.js:185:22)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at Request.onRequestError (/user_code/node_modules/request/request.js:877:8)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1296:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

Код Javascript

    const functions = require('firebase-functions');

    const request = require('request-promise')

    exports.indexPostsToElastic = functions.database.ref('/posts/{post_id}')
    .onWrite((change,context) => {
    let postData = change.after.val();
    let post_id = context.params.post_id;

    console.log('Indexing post:', postData);

    let elasticSearchConfig = functions.config().elasticsearch;
    let elasticSearchUrl = elasticSearchConfig.url + 'posts/post/' + 
     post_id;
    let elasticSearchMethod = postData ? 'POST' : 'DELETE';

    let elasticSearchRequest = {
        method: elasticSearchMethod,
        url: elasticSearchUrl,
        auth:{
            username: elasticSearchConfig.username,
            password: elasticSearchConfig.password,
        },
        body: postData,
        json: true
      };

      return request(elasticSearchRequest).then(response => {
         console.log("ElasticSearch response", response);
         return null;
      });
      });
...