Firebase 托管的本地服务器导致 React 应用程序中频繁出现 HTTP 错误

Local server for Firebase Hosting causing frequent HTTP errors in React app

一位在菲律宾宿务市工作的开发人员在使用 Firebase 和 Create React App 之间的通用配置时经常收到网络错误。我们使用 firebase serve 在一个终端 window 启动静态资产的本地服务器。它启动:

i  hosting: Serving hosting files from: build
✔  hosting: Local server: http://localhost:5000

在单独的 window 中,我们 运行 yarn start 在 Create React App 存储库中 package.json 文件中有一个 "proxy": "http://localhost:5000", 条目。我们经常观察到以下错误:

Proxy error: Could not proxy request /__/firebase/8.1.2/firebase-app.js from localhost:3000 to http://localhost:5000. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (HPE_INVALID_CONSTANT)

ERR_STREAM_WRITE_AFTER_END 个异常终止 Create React App 进程。

注意:偶尔不会出现错误。

我无法在美国重现这个问题。对于我认为相同的所有软件配置,我怀疑在 firebase 服务器执行其 Reserved URL“魔法”时可能存在网络问题。

您认为我怀疑网络问题是正确的吗?如果是这样,任何人都可以协助进行可能缓解问题的较低级别的网络配置吗? (我在考虑 connection/timeout 调整)。

如果您从 public/index.html 中的托管 URL 启动您的项目(像我一样),请尝试将 URL 更新到最新版本 (8.2.3),因此所有脚本将如下所示:

<script src="/__/firebase/8.2.3/firebase-app.js"></script>

这对我有用。我希望如此:)