Error when not passing uiConfig to Web3Auth on 7.0.1

Version: 7.0.1

On base plan, we cannot pass a uiConfig anymore, as seen in this screenshot.

Not passing the config results in this error

Uncaught TypeError: Cannot read properties of undefined (reading 'defaultLanguage')
    at new Web3Auth (modalManager.ts:79:32).

@afarley Thanks for your patience.

I am checking this with our Dev team and will revert to you with an update once received.

Our team mentioned in order to use the uiconfig/whitelabel option you would need to upgrade the plan as per the error message. You can take a look at our pricing page and upgrade accordingly:

@vjgee As mentioned in my original message, not passing the uiConfig object results in a fatal error:

Uncaught TypeError: Cannot read properties of undefined (reading 'defaultLanguage')
    at new Web3Auth (modalManager.ts:79:32).

Ok, I have forwarded your issue to our Dev team and will get back with an update once I hear from them.

Thanks for your understanding.

1 Like

Can you share your code for it? The whole implementation of your web3auth instance

@yashovardhan This code results in the crash specified earlier:

Note that we are also using web3auth-wagmi-connector

export const getWeb3AuthInstance = async (chains: Chain[]) => {
  const web3AuthInstance = new Web3Auth({
    clientId: environment.web3AuthClientId,
    web3AuthNetwork: 'cyan',
    sessionTime: 3600,
    chainConfig: {
      chainNamespace: CHAIN_NAMESPACES.EIP155,
      chainId: '0x' + chains[0].id.toString(16),
      rpcTarget: chains[0].rpcUrls.default.http[0],
      displayName: chains[0].name,
      tickerName: chains[0].nativeCurrency?.name,
      ticker: chains[0].nativeCurrency?.symbol,
      blockExplorer: chains[0]?.blockExplorers?.default.url ?? chains[0].rpcUrls.default.http[0],
    },
    enableLogging: false,
  });

  web3AuthInstance.configureAdapter(new MetamaskAdapter());
  web3AuthInstance.configureAdapter(new CoinbaseAdapter());
  const walletConnectSettings = await getWalletConnectV2Settings(
    CHAIN_NAMESPACES.EIP155,
    chains.map(chain => chain.id),
    environment.walletConnectProjectId,
  );
  web3AuthInstance.configureAdapter(new WalletConnectV2Adapter(walletConnectSettings));
  web3AuthInstance.configureAdapter(
    new OpenloginAdapter({
      adapterSettings: {
        uxMode: 'redirect',
        replaceUrlOnRedirect: false,
      },
      loginSettings: {
        mfaLevel: 'none', // Testnet
      },
    }),
  );

  return web3AuthInstance;
};

I’m having the exact same issue. Made also a connector myself until the team releases theirs, but getting the same issue you are getting

would be good if the team could release at least some sort of quickfix

@vjgee @yashovardhan Update for v7.0.2 of @web3auth/modal:

  • Metamask/Coinbase connectors works fine and don’t throw an error with passing or not passing uiConfig (on Base plan).
  • OpenLogin connector triggers the “Invalid Params - Something went wrong” page with passing and not passing uiConfig (on Base plan).

Whitelabeling is not available on Base plan. Please refer to the pricing page for more details. Do not pass uiConfig before upgrading to Growth and above plans.

@maharshi Not passing uiConfig still results in the “Invalid Params - Something went wrong” page being displayed when using OpenLogin (see original picture of this post).

If you’re not sending any customisation options being on Base you shouldn’t be receiving this message. Could you please share the web3auth initialisation snippet with me?

@maharshi

Package versions:
@web3auth/base”: “^7.0.1”,
@web3auth/coinbase-adapter”: “^7.0.2”,
@web3auth/metamask-adapter”: “^7.0.1”,
@web3auth/modal”: “^7.0.2”,
@web3auth/web3auth-wagmi-connector”: “^5.0.0”,

Complete code including wagmi config:

const getWeb3AuthInstance = async (chains: Chain[]) => {
  const web3AuthInstance = new Web3Auth({
    clientId: environment.web3AuthClientId,
    web3AuthNetwork: 'cyan',
    sessionTime: 3600,
    chainConfig: {
      chainNamespace: CHAIN_NAMESPACES.EIP155,
      chainId: '0x' + chains[0].id.toString(16),
      rpcTarget: chains[0].rpcUrls.default.http[0],
      displayName: chains[0].name,
      tickerName: chains[0].nativeCurrency?.name,
      ticker: chains[0].nativeCurrency?.symbol,
      blockExplorer: chains[0]?.blockExplorers?.default.url ?? chains[0].rpcUrls.default.http[0],
    },
    enableLogging: false,
  });

  web3AuthInstance.configureAdapter(new MetamaskAdapter());
  web3AuthInstance.configureAdapter(new CoinbaseAdapter());
  const walletConnectSettings = await getWalletConnectV2Settings(
    CHAIN_NAMESPACES.EIP155,
    chains.map(chain => chain.id),
    environment.walletConnectProjectId,
  );
  web3AuthInstance.configureAdapter(new WalletConnectV2Adapter(walletConnectSettings));
  web3AuthInstance.configureAdapter(new OpenloginAdapter());

  return web3AuthInstance;
};

const getWeb3AuthConnectorModalConfig = (): Record<string, ModalConfig> => ({
  openlogin: {
    label: 'openlogin',
    loginMethods: {
      discord: {
        name: 'discord',
        showOnModal: false,
      },
      twitch: {
        name: 'twitch',
        showOnModal: false,
      },
      apple: {
        name: 'apple',
        showOnModal: false,
      },
      line: {
        name: 'line',
        showOnModal: false,
      },
      kakao: {
        name: 'kakao',
        showOnModal: false,
      },
      weibo: {
        name: 'weibo',
        showOnModal: false,
      },
      wechat: {
        name: 'wechat',
        showOnModal: false,
      },
      sms_passwordless: {
        name: 'sms_passwordless',
        showOnModal: false,
      },
    },
  },
  [WALLET_ADAPTERS.TORUS_EVM]: {
    label: 'torus_evm',
    showOnModal: false,
  },
});

const {chains, publicClient, webSocketPublicClient} = configureChains(getChains(), [publicProvider()], {
  batch: {multicall: true},
});

const createBaseConfig = (connectors: Connector[]) =>
  createConfig({
    autoConnect: !!connectors.length && shouldWagmiAutoconnect(),
    connectors,
    publicClient,
    webSocketPublicClient,
  });

const baseConfig = createBaseConfig([]);

export const WagmiProvider: FunctionComponent<DefaultChildren> = ({children}) => {
  const [config, setConfig] = useState(baseConfig);

  useEffect(() => {
    const run = async () => {
      if (config.connectors.length > 0) return;

      const web3AuthInstance = await getWeb3AuthInstance(chains);

      const newConfig = createBaseConfig([
        new Web3AuthConnector({
          chains,
          options: {
            modalConfig: getWeb3AuthConnectorModalConfig(),
            web3AuthInstance: web3AuthInstance!,
          },
        }),
      ]);

      setConfig(newConfig);
    };
    run();
  }, [config.connectors.length]);

  return <WagmiConfig config={config}>{children}</WagmiConfig>;
};

i’m seeing this same issue. works fine on sapphire_devnet with no custom logo, sapphire_mainnet throws this error.

@maharshi Any news on this? Is there a quick fix or a solution in the meantime?

bump @maharshi @vjgee this seems to be impacting openlogin specifically

Hey @afarley, upgrade wagmi to 5.0.1 as it fixes some of the issues with 5.0.0.

@maharshi I updated web3auth-wagmi-connector to 5.0.1. We are still getting the same error on “cyan” network. Our project is on Legacy Cyan Mainnet and we cannot seem to be able to change it in the dashboard.

Hi @afarley, try commenting out all the adapters except openlogin and check if you’re still facing this issue.