8000 TypeError: n.subarray is not a function (regression in v5.25) · Issue #202 · statoscope/statoscope · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
TypeError: n.subarray is not a function (regression in v5.25)  #202
Closed
@iamakulov

Description

@iamakulov

Describe the bug

Heya – thank you for maintaining Statoscope! Incredibly useful tool.

Since I upgraded to v5.25, Statoscope started crashing when loading the UI. The error reads like this:

statoscope-unnamed-187619ba9f701cb87367.html:78 Uncaught TypeError: n.subarray is not a function
    at Object.inflate (statoscope-unnamed-187619ba9f701cb87367.html:78:38851)
    at window.Pako.la.push (statoscope-unnamed-187619ba9f701cb87367.html:78:45733)
    at statoscope-unnamed-187619ba9f701cb87367.html:1299:28
    at Array.map (<anonymous>)
    at Object.parse (statoscope-unnamed-187619ba9f701cb87367.html:1290:43)
    at statoscope-unnamed-187619ba9f701cb87367.html:1327:24

The relevant line seems to be this (this is the only mention of .subarray() in the diff between v5.24 and v5.25):

const chunk = binaryJSONCompressedArray.subarray(readIndex, readIndex + size);

If you pause at the exception, you’ll notice n is defined, it just doesn’t have the subarray function (because it’s a regular array):

Screenshot 2023-02-18 at 18 22 01

To Reproduce
Steps to reproduce the behavior:

  1. Run

    git clone git@github.com:appsmithorg/appsmith.git --depth 1
    cd appsmith/app/client
    cp .env.example .env
    yarn
  2. Install Statoscope:

    yarn add @statoscope/webpack-plugin
  3. Add Statoscope to craco.common.config.js:

    const StatoscopeWebpackPlugin = require("@statoscope/webpack-plugin").default;
    
    module.exports = {
      // ...
      webpack: {
        // ...
        configure: {
          // ...
          plugins: [new StatoscopeWebpackPlugin({ statsOptions: { all: true }, open: "file" })],
        }
      }
    }
  4. Build the app:

    yarn build
  5. Observe how the report opens but hangs at “Parsing...”. Observe the above error in the JS console

Expected behavior
The report should load successfully.

Screenshots

Screenshot 2023-02-18 at 18 32 51

Versions:

  • Node (for non-browser bug):
  • Browser (for browser-bug): 109.0.5414.119 (Official Build) (arm64)
  • Webpack: 5.73.0
  • Statoscope: 5.25

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0