Hello. I could use some help finding out why my ApiKey is not working.
import Moralis from 'moralis';
import { EvmChain } from '@moralisweb3/evm-utils';
function Native({ nativeBalance, address }) {
return (
<div>
<h3>Wallet: {address}</h3>
<h3>Native Balance: {nativeBalance} ETH</h3>
</div>
);
}
export async function getServerSideProps(context) {
await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
const address = '0x...';
const nativeBalance = await Moralis.EvmApi.balance.getNativeBalance({
chain: EvmChain.ETHEREUM,
address,
});
return {
props: { address, nativeBalance: nativeBalance.result.balance.ether },
};
}
export default Native;
For my env.local file
APP_CHAIN_ID=0x1
APP_DOMAIN=ethereum.boilerplate
MORALIS_API_KEY=mySuperSecretWeb3ApiKey
NEXTAUTH_SECRET= # Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/64
NEXTAUTH_URL=http://localhost:3000
I have tried hard coding my ApiKey in the process.env location and it worked perfectly. Any help on what I am missing would be wonderful.
Thanks much
Galant