Isomorphic-fetch 在使用 graph API 的 MS Teams 机器人的 Azure 部署中未找到。

huangapple go评论58阅读模式
英文:

Isomorphic-fetch not found on Azure Deployment for MS Teams Bot using graph API

问题

我们正在为Microsoft Teams上的Microsoft Bot Framework创建一个应用程序。此应用程序使用isomorphic fetch来进行图形API调用,以处理用户与呼叫相关的API。在必需的文件callApi.ts中导入了isomorphic fetch供图形API的呼叫模块使用。在本地调试时,应用程序构建没有任何错误。我们可以在本地运行它,但是当我们将应用程序部署到Azure云后,根据检查isomorphic fetch包的依赖关系,发现找不到它,这是呼叫API中的一个依赖项,因此机器人无法工作。

关于Isomorphic fetch的基本信息:
Isomorphic fetch是一个提供一致的API以进行HTTP请求的库,与浏览器和Node.js环境兼容。它允许编写可以在客户端和服务器端都运行而无需任何修改的代码。

为什么/如何使用它?
它不是作为一种选择使用的,而是作为图形API要求的依赖包。

首先尝试导入它到开发和构建依赖项中,这是我的package.json。

根据代码实现,我们没有使用fetch.get(...)node-fetch.get(...)isomorphic-fetch.get(...)
这个模块只是被导入并放在那里,没有在任何函数中调用。

已尝试的方法:

  1. 删除isomorphic-fetch,然后尝试构建。
  2. 尝试使用fetchnode-fetch代替isomorphic fetch
  3. 重新安装模块,有时会删除node模块文件夹。

在这种情况下是否有解决方案或可能遗漏了特定步骤导致这种情况?如果需要进一步的信息,请随时回复评论。

英文:

We are creating an application on Microsoft Bot Framework for Microsoft Teams. This app uses isomorphic fetch to make graph API calls for handling user call-related API. After importing the isomorphic fetch in the app in the required file callApi.ts for the calling modules of graph API. The app gets built without any errors for local debugging. We can run it locally but when we deploy the app to Azure cloud after deploying based on checking the locks regard to knowing that the isomorphic fetch package is not found which is a dependency in call API due to which the bot is not working.

Isomorphic-fetch 在使用 graph API 的 MS Teams 机器人的 Azure 部署中未找到。

Basic info about Isomorphic fetch for reference:
Isomorphic fetch is a library that provides a consistent API for making HTTP requests, compatible with browser and Node.js environments. It allows writing code that can run on both the client and server sides without any modifications.

Why / How we are using it?
It is not being used as a choice but as a dependency package graph API requirement.
Isomorphic-fetch 在使用 graph API 的 MS Teams 机器人的 Azure 部署中未找到。

The first query will be about trying to import it into both dev and build dependencies, here is my package.json.
Isomorphic-fetch 在使用 graph API 的 MS Teams 机器人的 Azure 部署中未找到。

Based on the code implementation, we are not using fetch.get(...) or node-fetch.get(...) or isomorphic-fetch.get(...)
This module is just imported and placed there, it is not being called in any of the functions.

Approaches already tried:

  1. Removing the isomorphic-fetch and try build
    Isomorphic-fetch 在使用 graph API 的 MS Teams 机器人的 Azure 部署中未找到。
  2. Tried using fetch or node-fetch instead of isomorphic fetch
    Isomorphic-fetch 在使用 graph API 的 MS Teams 机器人的 Azure 部署中未找到。
  3. Reinstalling the module with and without removing node module folder.

Is there any solution to this kind of scenario or any possibility of missing any specific step resulting in this situation? Please feel free to comment back if any further information is required.

答案1

得分: 3

从开发依赖中删除 isomorphic-fetch 并将其仅保留在主要依赖项中。

如果您发现生产构建不包括在“dependencies”和“devDependencies”中都列出的包,这意味着构建过程正在正确地排除开发依赖项,如预期的那样。

英文:

Remove isomorphic-fetch from the dev dependency and keep it only in the main dependencies.

If you see that the production build doesn't include a package that is listed in both "dependencies" and "devDependencies", it means that the build process is correctly excluding the development dependencies, as expected.

答案2

得分: 0

尝试以下建议,如果尚未尝试过:

  • 重新安装库。
  • 清除机器人的缓存。
  • 重新部署机器人。

额外提示:为测试而添加这些提示,但不确定是否会导致不兼容性,

  • 使用不同版本的isomorphic-fetch库。
英文:

Try these below suggestions if not tried:
-Reinstall the library.
-Clear the bot's cache.
-Redeploy the bot.

Additional point:Adding these point for testing but not sure it might leads to incompatibility,
-Using a different version of the isomorphic-fetch library.

huangapple
  • 本文由 发表于 2023年7月20日 19:28:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76729387.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定