Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

"callback already called" error #3008

Closed
1 task done
PierreMarieRiviere opened this issue Apr 26, 2020 · 33 comments
Closed
1 task done

"callback already called" error #3008

PierreMarieRiviere opened this issue Apr 26, 2020 · 33 comments

Comments

@PierreMarieRiviere
Copy link

PierreMarieRiviere commented Apr 26, 2020


Issue

Deploying on testnet fails with Error: callback already called (but deployment on Ganache succeeds).
The mentioned callback is at /node_modules/truffle/build/webpack:/~/ganache-core/~/merkle-patricia-tree/~/async/lib/async.js:358.

Steps to Reproduce

npx truffle unbox okwme/truffle-shavings

Create the .env as required here https://github.com/okwme/truffle-shavings
Delete truffle-config,js

yarn migrate --network rinkeby

You should get the error

Expected Behavior

Contract should be deployed on Rinkby or any other testnet

Actual Results

$yarn migrate --network rinkeby
yarn run v1.22.4
$ npx truffle migrate --network rinkeby

Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/Sample.sol
> Artifacts written to /Users/Pm/Documents/Ethereum/test2/build/contracts
> Compiled successfully using:
   - solc: 0.5.0+commit.1d4f565a.Emscripten.clang


/Users/Pm/Documents/Ethereum/test2/node_modules/truffle/build/webpack:/~/ganache-core/~/merkle-patricia-tree/~/async/lib/async.js:358
                callback(err);
^
Error: Callback was already called.
    at /Users/Pm/Documents/Ethereum/test2/node_modules/truffle/build/webpack:/~/ganache-core/~/merkle-patricia-tree/~/async/lib/async.js:43:1
    at WriteStream.<anonymous> (/Users/Pm/Documents/Ethereum/test2/node_modules/truffle/build/webpack:/~/ganache-core/~/merkle-patricia-tree/~/async/lib/async.js:358:1)
    at WriteStream.emit (events.js:315:20)
    at WriteStream.destroy (/Users/Pm/Documents/Ethereum/test2/node_modules/truffle/build/webpack:/~/level-ws/level-ws.js:140:1)
    at finish (_stream_writable.js:681:14)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment

  • OSX 10.15.3 (Catalina)
  • Web3.js v1.2.1
  • Truffle v5.1.23 (core: 5.1.23)
    • Solidity v0.5.16 (solc-js)
  • Node v14.0.0
  • npm 6.14.4
    • yarn 1.22.4
@PierreMarieRiviere
Copy link
Author

To anyone meeting this problem it could be due to
(1) Node 14. Revert to LTS (12.16.2 at time of writing)
(2) Anything else. Sorry. I formatted my computer in the meantime. Maybe some elder sudo messing up with my config.

@eggplantzzz
Copy link
Contributor

@TheDApact thanks for reporting this and for the repro steps! I'll take a look into why this is happening.

@eggplantzzz
Copy link
Contributor

eggplantzzz commented Apr 27, 2020

I was unable to duplicate your error. I tried with both Node 10 and 12. I could successfully migrate to ropsten like you instructed. I wonder what could be going on here.

@PierreMarieRiviere
Copy link
Author

PierreMarieRiviere commented Apr 27, 2020

I was on Node 14.0 best bet it's from Node.

Node 12.0 does it!

@eggplantzzz
Copy link
Contributor

I was able to on Node 14 too. Try upgrading your version of Truffle in the package.json. Currently it is set at ^5.0.2. Set it to at least ^5.1.0. My guess is that you are experiencing a bug we have already fixed. I was using the latest version of Truffle installed globally on my machine. Let me know what happens.

@PierreMarieRiviere
Copy link
Author

PierreMarieRiviere commented Apr 27, 2020

Still getting the same error with node 14.0 after upgrading truffle to ^5.1.0 in package.json.

At least we confirmed it stems from node 14.0

edit: same with 5.1.23

@eggplantzzz
Copy link
Contributor

eggplantzzz commented Apr 27, 2020

No I meant to say that I was able to successfully migrate to ropsten using Node 14. I'm not sure what's up with this. Are you using a globally installed version of Truffle? If so, can you do a truffle version just to ensure you are using the most recent version? I know we had some bug a while back that gave the error message that you reported...

@PierreMarieRiviere
Copy link
Author

Here is my environment

Truffle v5.1.23 (core: 5.1.23)
Solidity v0.5.16 (solc-js)
Node v14.0.0
Web3.js v1.2.1

npx truffle migrate will work if I downgrade Node to 12.16.2

Here are the packages installed globally on my (just formatted) OSX Catalina

├── npm@6.14.4
├── truffle@5.1.23
└── yarn@1.22.4

Worse mentioning that I added the snippet below to package.json found in the box, to fix an error with fsevent (see nodejs/node#27389)

"resolutions": {
    "**/**/fsevents": "^1.2.9"
 },

@eggplantzzz
Copy link
Contributor

eggplantzzz commented Apr 28, 2020

Hmm weird, it looks like I can duplicate your error with Node 14 today. I think it is unrelated to the resolutions property you mentioned above as I could duplicate it without it. We'll have to look into this later, thanks for the report! I really would like to get rid of the async library from the Truffle codebase :)

@nicholasjpaterno
Copy link
Contributor

I really would like to get rid of the async library from the Truffle codebase :)

Your wish is my command 🧞

@eggplantzzz
Copy link
Contributor

So the async library was removed from the latest version of Truffle (5.1.25) and re-attempting this migration I get the same error. So it looks like this error does not come from Truffle's direct usage of the library but is rather something else. More investigation will be necessary.

@glowkeeper
Copy link

glowkeeper commented Jun 3, 2020

Same error with this:

Truffle v5.1.25 (core: 5.1.25)
Solidity - 0.6.6 (solc-js)
Node v14.2.0
Web3.js v1.2.1

But everything is just fine with this:

Truffle v5.1.8 (core: 5.1.8)
Solidity - 0.6.6 (solc-js)
Node v12.14.1
Web3.js v1.2.1

@WillMandrill
Copy link

Hello

I am having the same error. Is this a bug?

/versions/node/v14.3.0/lib/node_modules/truffle/build/webpack:/node_modules/merkle-patricia-tree/node_modules/async/lib/async.js:358
callback(err);
^
Error: Callback was already called.

Truffle v5.1.28 (core: 5.1.28)
Solidity - 0.6.8 (solc-js)
Node v14.3.0
Web3.js v1.2.1

Thank you

Will

@JavierTrujilloG
Copy link

I was experiencing the same problem with Node v14.4.0
After switching to Node v12.0.0 with nvm it worked like a charm.

@CruzMolina
Copy link
Contributor

CruzMolina commented Jun 24, 2020

@PierreMarieRiviere This is an issue related to ganache-core's internals not yet being Node 14 compatible (trufflesuite/ganache#732).

You should be able to to deploy to any of the production networks (including testnets) with truffle on Node 14, by skipping the dry run (truffle migrate --network rinkeby --skipDryRun). The dry run uses ganache's forking feature to simulate the deployment for production networks.

@DanielTongAwesome
Copy link

DanielTongAwesome commented Jun 27, 2020

I was experiencing the same problem with the following setting:
Truffle v5.1.31
node v14.4.0
Solidity v0.5.0

It works for me after I tried 'truffle migrate --network rinkeby --skipDryRun'

@PierreMarieRiviere This is an issue related to ganache-core's internals not yet being Node 14 compatible (trufflesuite/ganache-cli#732).

You should be able to to deploy to any of the production networks (including testnets) with truffle on Node 14, by skipping the dry run (truffle migrate --network rinkeby --skipDryRun). The dry run uses ganache's forking feature to simulate the deployment for production networks.

Thank you !

@TanjaNY
Copy link

TanjaNY commented Aug 26, 2020

same issue.
Truffle v5.1.41 (core: 5.1.41)
Solidity v0.5.16 (solc-js)
Node v14.5.0
Web3.js v1.2.1

@glowkeeper
Copy link

glowkeeper commented Aug 26, 2020 via email

@TanjaNY
Copy link

TanjaNY commented Aug 26, 2020

'truffle migrate --network ropsten --skipDryRun' worked for me though.

@glowkeeper
Copy link

glowkeeper commented Aug 26, 2020 via email

@felipegontijo
Copy link

Skipping Dry Run also worked for me.

Note: it can be added in the networks configs in truffle-config.js as skipDryRun: true as well!

Why isn't this issue closed already? Or are there implications on skipping the dry run, so waiting for a "permanent" fix?

@eggplantzzz
Copy link
Contributor

Is there anything else actionable here on this issue (other than supporting Node 14)? Just to reiterate, Truffle is not currently compatible with Node 14. Part of the problem is that Ganache is not yet compatible with Node 14 and Truffle uses that "under the hood".

@ashutoshsinghparmar
Copy link

had same issue with migrate to any live network:
Environment:
Truffle v5.1.46 (core: 5.1.46)
Solidity v0.5.16 (solc-js)
Node v14.13.0
Web3.js v1.2.1

skipDryRun worked for me too....
@CruzMolina Thanks...

@eggplantzzz
Copy link
Contributor

@ashu12318 Try upgrading to the latest Truffle. It is only as of Truffle version 5.1.49 that Truffle has been compatible with Node 14.

@steelep
Copy link

steelep commented Jan 22, 2021

I was getting this with the latest version of truffle attempting to deploy to mainnet. Kovan & Ropsten deployments worked fine.

Work around was adding "skipDryRun: true" to truffle-config.js for mainnet.

@SomeJoker
Copy link

SomeJoker commented May 26, 2021

I try to use "skipDryRun" but not success。But I find use V12.22.1 node solve this problem( My original version is 14.17.0 )。
sudo npm install n -g
n 12.22.1
then I success to run
truffle migrate --network rinkeby

@eggplantzzz
Copy link
Contributor

Is there anything else actionable on this? Otherwise we will go ahead and close this issue. Thanks!

@SomeJoker
Copy link

now, I meet another problem。 when I run truffle compile, I got a
'Eorror: Could not find a compiler version matching 0.6.10. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run truffle compile --list to see available versions'
I run 'truffle compile --list --all' ,can got version list, include I want version(0.6.10).
so, how to slove this problem.

@haltman-at
Copy link
Contributor

@SomeJoker That sounds like an unrelated issue, so if you're still having a problem with that, you should open a new issue for it. Meanwhile, we're going to close this one. Thanks!

@williamCareyJr
Copy link

When I use truffle migrate --network kovan --skipDryRun
I receive the following error:

**Error: *** Deployment Failed ***

"Migrations" -- Web3ProviderEngine does not support synchronous requests..**

@haltman-at
Copy link
Contributor

@williamCareyJr That sounds like a different issue. Would you mind filing a new issue for that, with more detailed reproduction steps? Thanks!

@YashNagiReddy7
Copy link

even I have faced the same error, I have used nvm use 16 and did truffle migrate --reset --skipdryrun, it worked for mr and the contract has been deployed!

@AGRTECH
Copy link

AGRTECH commented Dec 4, 2022

Thanks so much for this guys I was getting this same error and I was on node 16 and reverted back to 12 and I was able to deploy onto goerli

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

No branches or pull requests