Copilot commented on code in PR #39369:
URL: https://github.com/apache/superset/pull/39369#discussion_r3190495736


##########
superset-frontend/package.json:
##########
@@ -223,7 +223,7 @@
     "redux-undo": "^1.0.0-beta9-9-7",
     "rison": "^0.1.1",
     "scroll-into-view-if-needed": "^3.1.0",
-    "simple-zstd": "^1.4.2",
+    "simple-zstd": "^2.1.0",

Review Comment:
   Upstream `simple-zstd` v2.x drops support for Node.js 20 and requires Node 
>= 22 (per the referenced upstream commits/release notes). If this repo’s 
CI/build images or developer tooling still use Node 20, installs/builds will 
fail. Either (a) update the frontend’s declared/managed Node version (e.g., 
engines/.nvmrc/CI images) to >= 22, or (b) keep `simple-zstd` pinned on 
`^1.4.2` until the Node baseline is raised.
   



##########
superset-frontend/webpack.proxy-config.js:
##########
@@ -116,21 +116,21 @@ function copyHeaders(originalResponse, response) {
  * Manipulate HTML server response to replace asset files with
  * local webpack-dev-server build.
  */
-function processHTML(proxyResponse, response) {
+async function processHTML(proxyResponse, response) {
   let body = Buffer.from([]);
   let originalResponse = proxyResponse;
-  let uncompress;
   const responseEncoding = originalResponse.headers['content-encoding'];
 
   // decode GZIP response
+  let uncompress;
   if (responseEncoding === 'gzip') {
     uncompress = zlib.createGunzip();
   } else if (responseEncoding === 'br') {
     uncompress = zlib.createBrotliDecompress();
   } else if (responseEncoding === 'deflate') {
     uncompress = zlib.createInflate();
   } else if (responseEncoding === 'zstd') {
-    uncompress = ZSTDDecompress();
+    uncompress = await zstdDecompress();

Review Comment:
   The code pipes an HTTP response stream into `uncompress`, so `uncompress` 
must be a Node stream/duplex. Importing `decompress` and calling it with no 
arguments is a strong mismatch with the common semantics of a 
`decompress(input)` API (typically returning a Buffer/Uint8Array rather than a 
stream), which would cause a runtime failure when calling 
`originalResponse.pipe(uncompress)`. Please verify the v2 `simple-zstd` API for 
creating a decompression stream/ProcessDuplex and use the correct stream 
factory for `content-encoding: zstd`.



##########
superset-frontend/webpack.proxy-config.js:
##########
@@ -17,7 +17,7 @@
  * under the License.
  */
 const zlib = require('zlib');
-const { ZSTDDecompress } = require('simple-zstd');
+const { decompress: zstdDecompress } = require('simple-zstd');

Review Comment:
   The code pipes an HTTP response stream into `uncompress`, so `uncompress` 
must be a Node stream/duplex. Importing `decompress` and calling it with no 
arguments is a strong mismatch with the common semantics of a 
`decompress(input)` API (typically returning a Buffer/Uint8Array rather than a 
stream), which would cause a runtime failure when calling 
`originalResponse.pipe(uncompress)`. Please verify the v2 `simple-zstd` API for 
creating a decompression stream/ProcessDuplex and use the correct stream 
factory for `content-encoding: zstd`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to