entropyxyz / cli

CLI utility to ease interactions with an Entropy network.
GNU Affero General Public License v3.0
5 stars 0 forks source link

Getting a `TypeError: Invalid chunk type in stream write operation` error on `entropy balance` #181

Closed johnnymatthews closed 4 months ago

johnnymatthews commented 4 months ago

Getting the error when attempting to check the balance of an account using the CLI:

$ entropy balance "5DSUAf2DwxW2ebZq15Pm6Z3SJ69Ur8fGd8ytWvgxvNjYtr7c"

@polkadot/util-crypto has multiple versions, ensure that there is only one installed.
Either remove and explicitly install matching versions or dedupe using your package manager.
The following conflicting packages were found:
        esm 12.6.2      node_modules/@entropyxyz/sdk/dist/
        esm 12.6.2      node_modules/@polkadot/util-crypto/
(node:53619) [UNDICI-WS] Warning: WebSockets are experimental, expect them to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
2024-07-16 22:02:24        REGISTRY: Unknown signed extensions ValidateConfirmRegistered found, treating them as no-effect
2024-07-16 22:02:24        API/INIT: RPC methods not decorated: chainSpec_v1_chainName, chainSpec_v1_genesisHash, chainSpec_v1_properties
node:internal/streams/writable:474
      throw new ERR_INVALID_ARG_TYPE(
            ^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (0)
    at _write (node:internal/streams/writable:474:13)
    at Writable.write (node:internal/streams/writable:502:10)
    at writeOut (file:///home/io/.local/share/pnpm/global/5/.pnpm/@entropyxyz+cli@0.0.2/node_modules/@entropyxyz/cli/dist/cli.js:1362:18)
    at Command.<anonymous> (file:///home/io/.local/share/pnpm/global/5/.pnpm/@entropyxyz+cli@0.0.2/node_modules/@entropyxyz/cli/dist/cli.js:1348:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v22.3.0

The account I tried to check exists in my ~/.entropy-cli.config, although I think it has a 0 balance.

johnnymatthews commented 4 months ago

Can confirm that this fix works. Getting a lot of other warnings and errors, but I'm actually receiving a balance now, which is great!

@polkadot/util-crypto has multiple versions, ensure that there is only one installed.
Either remove and explicitly install matching versions or dedupe using your package manager.
The following conflicting packages were found:
        esm 12.6.2      node_modules/@entropyxyz/sdk/dist/
        esm 12.6.2      node_modules/@polkadot/util-crypto/
(node:124561) [UNDICI-WS] Warning: WebSockets are experimental, expect them to change at any time.
(Use `node --trace-warnings ...` to show where the warning was created)
2024-07-17 17:12:04        REGISTRY: Unknown signed extensions ValidateConfirmRegistered found, treating them as no-effect
2024-07-17 17:12:04        API/INIT: RPC methods not decorated: chainSpec_v1_chainName, chainSpec_v1_genesisHash, chainSpec_v1_properties
0 BITS%