reactjs - 为 Azure ABP.IO React 移动应用设置环境变量
问题描述
我已创建 abp.io 项目并将其部署到 Azure。我已成功创建数据库和 Web 应用程序。
现在我正在探索 React 移动前端。我正在尝试将 React 应用程序指向 localhost 或 Azure 服务器。
我已根据文档(https://docs.abp.io/en/abp/latest/Getting-Started-React-Native)将环境变量“apiUrl”和“issuer”设置为我的 IP 和我的天蓝色网站,并且得到如下所示的相同错误。
本地主机错误:
Network Error
The above error occurred in task fetchAppConfig
created by takeLatest(app/fetchAppConfigAsync, fetchAppConfig)
created by _callee
created by rootSaga
Tasks cancelled due to error:
takeLatest(app/fetchAppConfigAsync, fetchAppConfig)
takeLatest(app/setLanguageAsync, setLanguage)
takeLatest(app/logoutAsync, logout)
天青错误:
Request failed with status code 500
- node_modules\axios\lib\core\createError.js:15:17 in createError
- node_modules\axios\lib\core\settle.js:16:9 in settle
- node_modules\axios\lib\adapters\xhr.js:53:6 in handleLoad
- node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEvent
- node_modules\react-native\Libraries\Network\XMLHttpRequest.js:592:4 in setReadyState
- node_modules\react-native\Libraries\Network\XMLHttpRequest.js:395:6 in __didCompleteResponse
- node_modules\react-native\Libraries\vendor\emitter\EventEmitter.js:189:10 in emit
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
* [native code]:null in callFunctionReturnFlushedQueue
The above error occurred in task fetchAppConfig
created by takeLatest(app/fetchAppConfigAsync, fetchAppConfig)
created by _callee
created by rootSaga
Tasks cancelled due to error:
takeLatest(app/fetchAppConfigAsync, fetchAppConfig)
takeLatest(app/setLanguageAsync, setLanguage)
takeLatest(app/logoutAsync, logout)
Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`
.
.
.
* [native code]:null in callFunctionReturnFlushedQueue
解决方案
我有同样的问题我做了以下事情:
- 使用 HTTP,而不是 HTTPS [我认为这可以解决您的 azure 问题]
- 使用Conveyor获取本地 Web 应用程序的 URL,而不是使用 localhost,因为未为移动设备定义 localhost
推荐阅读
- c++ - 你能动态生成一个初始化列表吗?
- c# - 如何将 Flurl 与 HttpClient 实例一起使用
- python - 如何对 GPS 坐标进行样条插值?
- angular - 如何从 agm-map 中清除多边形?
- woocommerce - 如何在woocommerce的订单退款过程中忽略自定义字段
- ms-access - 查询从子表单更新主表单
- powershell - 尝试启动 Edge 浏览器时,powershell 的启动进程 cmdlet 将因 -PassThru 参数而失败
- firebase - 无法将功能部署到 Firebase
- python - 循环仅适用于 6 个元素(链接)请求
- python - 如何将降价文件转换为保持树结构的 csv 文件