Error Details
Error Type: TypeError
Error Message: Cannot read properties of undefined (reading ‘setKeyExportFlag’)
Description
An error occurred when attempting to set web3auth no modal init
Steps to Reproduce
- [Need more information]
Expected Behavior
[Need more information]
Actual Behavior
The application throws a TypeError, indicating that it’s attempting to access a property of an undefined object.
Possible Causes
- The object containing
setKeyExportFlag
may not have been properly initialized. - There might be a race condition where the object is being accessed before it’s fully defined.
- The object might have been accidentally overwritten or set to undefined elsewhere in the code.
Suggested Next Steps
- Identify the specific line of code where this error is occurring.
- Check the object’s initialization and ensure it’s properly defined before
setKeyExportFlag
is called. - Use debugging tools to trace the object’s state leading up to the error.
- Implement null checks before accessing
setKeyExportFlag
.
Additional Context
js```
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: ‘0x’ + activeChain.id.toString(16),
rpcTarget: https://base-${dev ? 'sepolia' : 'mainnet'}.g.alchemy.com/v2/${PUBLIC_ALCHEMY_KEY}
,
tickerName: activeChain.nativeCurrency?.name,
displayName: activeChain.name,
ticker: activeChain.nativeCurrency?.symbol,
blockExplorer: activeChain?.blockExplorers.default?.url as string
};
const web3AuthNoModal = new Web3AuthNoModal({
clientId: PUBLIC_WEB3AUTH_ID,
chainConfig,
web3AuthNetwork: dev ? 'sapphire_devnet' : 'sapphire_mainnet',
sessionTime: 86400 * 7
});
const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({ config: { chainConfig } });
const openloginAdapter = new AuthAdapter({
privateKeyProvider: ethereumPrivateKeyProvider,
loginSettings: {
mfaLevel: 'none'
},
adapterSettings: {
uxMode: 'redirect',
network: dev ? 'sapphire_devnet' : 'sapphire_mainnet',
whiteLabel: {
appName: 'rip.fun',
defaultLanguage: 'en',
mode: 'dark'
}
}
});
web3AuthNoModal.configureAdapter(openloginAdapter);