Node.js Google Неофициальная ошибка API: Ошибка при получении информации с сервера.[RH-01] - PullRequest
0 голосов
/ 19 сентября 2019

Я пытаюсь создать функцию Lambda, которая будет загружать установочный файл .apk для указанного приложения из Google Play, а затем загружать его на S3.Может кто-нибудь помочь?

Время выполнения

  • Узел 10.x

Пакеты

Вот мой код для загрузки функций

async function apkDownload(contentBucket, contentId, appId) {
    return new Promise(async (resolve, reject) => {
        try {
            const outputStream = new stream.PassThrough();
            const params = {
                Bucket: contentBucket,
                Key: `apk/${contentId}.apk`,
                Body: outputStream
            };

            s3.upload(params, function (error, data) {
                if (error) {
                    reject(error);
                } else {
                    resolve(data);
                }
            });

            getApkDetails = await apkDetails(appId);

            if (getApkDetails) {
                /**
                 * ! ERROR IN TRY-CATCH BLOCK
                 * "errorMessage": "Error retrieving information from server. [RH-01]"
                 */
                try {
                    apkDownload = await googleplayapi.download(appId, getApkDetails.version);
                } catch (error) {
                    reject(error);
                }
                if (apkDownload) {
                    apkDownload.pipe(outputStream);
                }
            }
        } catch (error) {
            reject(error);
        }
    });
}

async function apkDetails(appId) {
    try {
        return await gplayscraper.app({
            appId: appId
        })
    } catch (error) {
        console.log(error);
        return false;
    }
}

Вот лямбда-логи

{
  "errorType": "RequestError",
  "errorMessage": "Error retrieving information from server. [RH-01]",
  "trace": [
    "RequestError: Error retrieving information from server. [RH-01]",
    "    at handleErr (/var/task/apkDownload/node_modules/gpapi/lib/api.js:241:31)",
    "    at /var/task/apkDownload/node_modules/gpapi/lib/api.js:246:18",
    "    at tryCatcher (/var/task/apkDownload/node_modules/bluebird/js/release/util.js:16:23)",
    "    at Promise._settlePromiseFromHandler (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:514:35)",
    "    at Promise._settlePromise (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:574:18)",
    "    at Promise._settlePromise0 (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:619:10)",
    "    at Promise._settlePromises (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:699:18)",
    "    at Promise._fulfill (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:643:18)",
    "    at PromiseArray._resolve (/var/task/apkDownload/node_modules/bluebird/js/release/promise_array.js:126:19)",
    "    at PromiseArray._promiseFulfilled (/var/task/apkDownload/node_modules/bluebird/js/release/promise_array.js:144:14)",
    "    at PromiseArray._iterate (/var/task/apkDownload/node_modules/bluebird/js/release/promise_array.js:114:31)",
    "    at PromiseArray.init [as _init] (/var/task/apkDownload/node_modules/bluebird/js/release/promise_array.js:78:10)",
    "    at Promise._settlePromise (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:571:21)",
    "    at Promise._settlePromise0 (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:619:10)",
    "    at Promise._settlePromises (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:699:18)",
    "    at Promise._fulfill (/var/task/apkDownload/node_modules/bluebird/js/release/promise.js:643:18)"
  ]
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...