Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: n.subarray is not a function (regression in v5.25) #202

Closed
iamakulov opened this issue Feb 18, 2023 · 2 comments
Closed

TypeError: n.subarray is not a function (regression in v5.25) #202

iamakulov opened this issue Feb 18, 2023 · 2 comments

Comments

@iamakulov
Copy link

iamakulov commented Feb 18, 2023

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
@smelukov
Copy link
Member

@iamakulov Thanks! Working on it

@smelukov
Copy link
Member

smelukov commented Feb 18, 2023

@iamakulov there were a few problems. I've fixed these
Published in 5.25.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants