@vercel/microfrontends 2.3.3 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/microfrontends
2
2
 
3
+ ## 2.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 7af3542: Prevent local proxy crashes when upstream errors occur after response headers have already been sent.
8
+
3
9
  ## 2.3.3
4
10
 
5
11
  ### Patch Changes
package/dist/bin/cli.cjs CHANGED
@@ -30,7 +30,7 @@ var import_commander = require("commander");
30
30
  // package.json
31
31
  var package_default = {
32
32
  name: "@vercel/microfrontends",
33
- version: "2.3.3",
33
+ version: "2.3.4",
34
34
  private: false,
35
35
  description: "Defines configuration and utilities for microfrontends development",
36
36
  keywords: [
@@ -2689,6 +2689,12 @@ var LocalProxy = class {
2689
2689
  this.proxy = import_http_proxy.default.createProxyServer({ secure: true });
2690
2690
  this.proxy.on("error", (err, req, res) => {
2691
2691
  if (res instanceof http.ServerResponse) {
2692
+ if (res.destroyed || res.writableEnded)
2693
+ return;
2694
+ if (res.headersSent) {
2695
+ res.destroy(err);
2696
+ return;
2697
+ }
2692
2698
  res.writeHead(500, {
2693
2699
  "Content-Type": "text/plain"
2694
2700
  });
@@ -2858,6 +2864,12 @@ var LocalProxy = class {
2858
2864
  req.pipe(proxyReq);
2859
2865
  proxyReq.on("error", (err) => {
2860
2866
  logger.error("Proxy request error: ", err);
2867
+ if (res.destroyed || res.writableEnded)
2868
+ return;
2869
+ if (res.headersSent) {
2870
+ res.destroy(err);
2871
+ return;
2872
+ }
2861
2873
  res.writeHead(500, { "Content-Type": "text/plain" });
2862
2874
  res.end(
2863
2875
  `Error proxying request for ${target.application} to ${hostname}:${port}${path7}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/microfrontends",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "private": false,
5
5
  "description": "Defines configuration and utilities for microfrontends development",
6
6
  "keywords": [