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

node web3.js returning TypeError #3711

Closed
Sam-Devs opened this issue Sep 4, 2020 · 3 comments
Closed

node web3.js returning TypeError #3711

Sam-Devs opened this issue Sep 4, 2020 · 3 comments
Labels
Stale Has not received enough activity

Comments

@Sam-Devs
Copy link

Sam-Devs commented Sep 4, 2020

Expected behaviour

I expected it to return the value of the smart contract I called.

Actual behavior

Steps to reproduce the behaviour

  1. [First step]
  2. [Second step]
  3. [and so on...]

Logs

I ran node web3.js in the terminal to test contract functions and it returned
internal/validators.js:125
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object
at validateString (internal/validators.js:125:11)
at Module.require (internal/modules/cjs/loader.js:632:3)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (D:\Sammy\Projects\Altostream-Smartcontract\Web3\web3.js:5:14)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Environment

node version v10
web3 v1.2.11
Windows 10

@GregTheGreek
Copy link
Contributor

Are you able to provide reproducible example for us?

@NicolasKritter
Copy link

It looks like you you try to call a function of your smart contract with an argument that is of the wrong type (id should be a string and not an object).

It seems it is a normal behavior as web3 checks the arg type before making the request.

try to log the arguments before making the call and see what happens

@github-actions
Copy link

github-actions bot commented Nov 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Has not received enough activity
Projects
None yet
Development

No branches or pull requests

3 participants