You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to make use of Promise.any in a Typescript package and I came across the above error. Interestingly it is failing only on our circleci/node:14 build but works fine on all local node builds.
I was able to find a workaround so posting this here for rather documentation purposes than a bug report.
This is where the call is being made:
importpromiseAnyfrom'promise.any';
...
...
constrpcPromises: Promise<string>[] = [];
for (const web3 of web3array) {rpcPromises.push(web3.eth.getCode(address));console.log(web3.currentProvider);}try{// Promise.any for Node v15.0.0<console.log(rpcPromises)returnpromiseAny([
...rpcPromises,newPromise((_resolve,reject)=>{setTimeout(()=>reject('RPC took too long to respond'),3e3);})])}catch(err: any){console.log(err)thrownewError(err);}
and I get the following Error output:
ethereum-sourcify: TypeError: #<Object> is not a constructor
ethereum-sourcify: at Object.resolve (<anonymous>)
ethereum-sourcify: at PromiseResolve (/home/circleci/source-verify/services/verification/node_modules/es-abstract/2020/PromiseResolve.js:15:9)
ethereum-sourcify: at /home/circleci/source-verify/services/verification/node_modules/promise.any/implementation.js:31:21
ethereum-sourcify: at Array.map (<anonymous>)
ethereum-sourcify: at map (/home/circleci/source-verify/services/verification/node_modules/array.prototype.map/index.js:17:18)
ethereum-sourcify: at Object.any (/home/circleci/source-verify/services/verification/node_modules/promise.any/implementation.js:30:16)
ethereum-sourcify: at Object.any [as default] (/home/circleci/source-verify/services/verification/node_modules/promise.any/index.js:16:9)
ethereum-sourcify: at Object.getBytecode (/home/circleci/source-verify/services/verification/build/utils.js:68:37)
ethereum-sourcify: at Injector.matchBytecodeToAddress (/home/circleci/source-verify/services/verification/build/services/Injector.js:120:50)
ethereum-sourcify: at Injector.inject (/home/circleci/source-verify/services/verification/build/services/Injector.js:346:32)
ethereum-sourcify: at runMicrotasks (<anonymous>)
ethereum-sourcify: at processTicksAndRejections (internal/process/task_queues.js:95:5)
git clone https://github.com/ethereum/sourcify.git && cd sourcify && git checkout 4265f6b2d219bed10e08ab76f7912e413f5c9e1f
Install dependencies with lerna. Here the difference with CircleCI and the local builds is that CircleCI installs with a --ci flag. I can only reproduce with the --ci flag
npx lerna bootsrap --ci
Run the tests
npm run test
If you install without the --ci flag the tests will all pass.
I'd strongly suggest using babel, not tsc, to transpile your TypeScript - for many reasons - which would avoid having to use the nonstandard import = require syntax.
I'll close this, because this package is correct by spec, and there's nothing we can do until TS fixes its transpilation bug.
The tests were failing because of an unknown issue with the Promise.any
shim package used. Tests were working locally because locally `npx lerna
bootstrap` was being used but CircleCI uses `npx lerna bootstrap --ci`.
Changes fix the error and tests pass.
The issue is documented here:
es-shims/Promise.any#11
I was trying to make use of Promise.any in a Typescript package and I came across the above error. Interestingly it is failing only on our circleci/node:14 build but works fine on all local node builds.
I was able to find a workaround so posting this here for rather documentation purposes than a bug report.
This is where the call is being made:
and I get the following Error output:
The bug happened at the commit ethereum/sourcify@4265f6b when running the tests on circleci.
Reproduce
To reproduce clone the repo and checkout the commit ethereum/sourcify@4265f6b.
Install dependencies with lerna. Here the difference with CircleCI and the local builds is that CircleCI installs with a
--ci
flag. I can only reproduce with the--ci
flagRun the tests
If you install without the
--ci
flag the tests will all pass.Fix
Following this comment in this issue, I was able to fix the problem es-shims/Promise.allSettled#5 (comment)
The text was updated successfully, but these errors were encountered: