Firebase云功能在模拟器中工作,但未能部署



我正在为一个小型项目工作,我需要调用一个外部api,但我无法部署该函数,我遇到了以下错误,

错误:部署函数时出错

我在firebase-debug.log中找不到任何东西。当我调用与http触发函数相同的函数并从模拟器中测试它时,它工作了,但是,我无法部署。

exports.scheduledFunction = functions.pubsub.schedule("every 1 minute").onRun(async (context) => {
const response = await getResponse();
functions.logger.log(response);
return null;
});
function getResponse() {
const url = "https://pikas.techinsight.com.my/kgateway/testing.php";
return new Promise((resolve, reject) => {
axios.get(url).then((response) => {
return resolve(response.data.split("n"));
}).catch((error) => {
functions.logger.log(error);
return reject(error);
});
});
}

这是debug.log

[debug] [2021-11-15T18:41:34.063Z] Error: Failed to update function scheduledFunction in region us-central1
at /usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:38:11
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Fabricator.updateV1Function (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:250:32)
at async Fabricator.updateEndpoint (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:134:13)
at async handle (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:75:17)
[error] 
[error] Error: There was an error deploying functions

请帮我看看我做错了什么

检查是否已将所有依赖项安装在/functions文件夹中。我错误地在项目的根目录中安装了一些依赖项。模拟器仍然能够解决这些依赖关系,但部署失败。

最新更新