AElfProject / aelf-web3.js

aelf JavaScript SDK
MIT License
16 stars 24 forks source link

Bug: node-fetch, request is not a function #173

Closed hzz780 closed 2 months ago

hzz780 commented 4 months ago

Description

nodejs.TypeError: request is not a function
    at HttpProvider.requestSendByFetch (/opt/workspace/aelf-block-api/node_modules/aelf-sdk/dist/aelf.cjs.js:41995:14)
    at HttpProvider.sendAsyncByFetch (/opt/workspace/aelf-block-api/node_modules/aelf-sdk/dist/aelf.cjs.js:42015:33)
    at HttpProvider.sendAsync (/opt/workspace/aelf-block-api/node_modules/aelf-sdk/dist/aelf.cjs.js:42103:32)
    at RequestManager.sendAsync (/opt/workspace/aelf-block-api/node_modules/aelf-sdk/dist/aelf.cjs.js:41875:28)
    at ChainMethod.run (/opt/workspace/aelf-block-api/node_modules/aelf-sdk/dist/aelf.cjs.js:40028:34)

Steps To Reproduce

const aelf = new AElf(new AElf.providers.HttpProvider('https://aelf-public-node.aelf.io', 8000, {}, requestOptions));

async function main() {
  const status = await aelf.chain.getChainStatus();
  console.log('status: ', status);
}
main();

Current Behavior

-

Expected Behavior

Environment