Skip to content

TypeError: unexpected type, use Uint8Array #4996

Closed
@eolszewski

Description

@eolszewski

Is this a bug report?

Yes

Bug

When calling nacl.sign.keyPair.fromSeed from react-scripts, I get the following error:

TypeError: unexpected type, use Uint8Array
      
      at checkArrayTypes (node_modules/factom/node_modules/tweetnacl/nacl-fast.js:2151:13)
      at Function.Object.<anonymous>.nacl.sign.keyPair.fromSeed (node_modules/factom/node_modules/tweetnacl/nacl-fast.js:2313:3)
      at TransactionBuilder.input (node_modules/factom/src/transaction.js:209:38)
      at buildTransactionWithFees (node_modules/factom/src/send.js:73:10)
      at Object.createEntryCreditPurchaseTransaction (node_modules/factom/src/send.js:68:12)
          at <anonymous>

This is only happening when running this as a test - it cannot be replicated, otherwise.

Reproducing

here's the related branch of the repo I'm working with.

Setup

You will need to create a .env file with the following defined (these are all community-known test values):

FACTOM_PK=FA2jK2HcLnRdS94dEcU27rF3meoJfpUcZPSinpb7AwQvPRY6RL1Q
FACTOM_SK=Fs3E9gV6DXsYzf7Fqx1fVBQPQXV695eP3k5XbmHEZVRLkMdD9qCK
EC_PK=EC2Hx7nxJMDQMPtXkrQuhdnFyUZvPrkSSLaNefXdMPiLjCQeshu7
EC_SK=Es2riHLhuNAvY5CrzrqPa9moZiHgnG32DpAXT2mspyD6K5jt8UaX

Running Services

npm i
docker-compose up -d

Running with node

node factom.js

Running with react-scripts

npm test src/decentralized-storage/factom/

You will notice the error on the second run in node_modules/factom/src/transaction.js:209, but when you look into the types of the variables in question, they are the same between runs!

Help greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions