i am using this in react native and amazed with thing that in one project its giving me the balance without any error but that project is only for testing ,but when i integrated it with the main project it gives me the above mentioned error i also doubled checked the versions for both but still getting this, attaching my code snippest below
const connection = new Web3.Connection('https://api.mainnet-beta.solana.com');
// 5YNmS1R9nNSCDzb5a7mMJ1dwK9uHeAAF4CmPEwKgVWr8
const feePayer = Web3.Keypair.fromSecretKey(
base58.decode(
'reQRFKEf8jk9BZ8AptA2xww3qQ4h8omtvheKBaG9u2cBGjRcj547wVgQDkQgbPrsu2Z6phTonpAocaqmxGTR7ox',
),
);
const getBalanceSol = async () => {
try {
let balance = await connection.getBalance(feePayer.publicKey);
console.log(`${balance / Web3.LAMPORTS_PER_SOL} SOL`);
} catch (error) {
console.log('error while getting balance ', error);
}
};