Failed to connect with wallet. Chain null not supported

Hey, I could keep due with some help, Im trying to set up a Web3auth instance to support Solana wallets via the “default-solana-adapter” but I keep getting this error:

“WalletLoginError: Failed to connect with wallet. Chain null not supported. Supported chains are solana:mainnet, solana:devnet, solana:testnet
at WalletLoginError.fromCode (index.js:133:1)
at WalletLoginError.connectionError (index.js:136:1)
at WalletStandardAdapter.connect (walletStandardAdapter.js:69:89)”

It happens whenever I click on any recognized and injected Solana wallet in the Modal

A full breakdown of my ContextConfig

// Chain config for Solana
const chainConfig = {
    chainNamespace: CHAIN_NAMESPACES.SOLANA,
    chainId: "solana:devnet", 
    rpcTarget: "https://api.devnet.solana.com", 
    displayName: "Solana Devnet",
    blockExplorer: "https://explorer.solana.com/?cluster=devnet",
    ticker: "SOL",
    tickerName: "Solana"
  };
  
  // Initialize private key provider
  const privateKeyProvider = new SolanaPrivateKeyProvider({
    config: { chainConfig }
  });
  
  // Web3Auth Options
  const web3AuthOptions: Web3AuthOptions = {
    clientId,
    web3AuthNetwork: "sapphire_devnet" as WEB3AUTH_NETWORK_TYPE, 
    chainConfig,
    enableLogging: true,
    sessionTime: 3600 * 7,
    privateKeyProvider,
    storageKey: "local",
    uiConfig: {
        theme: "dark",
        loginMethodsOrder: ["google", "facebook", "twitter"],
        defaultLanguage: "en",
    }
  };

  // External Adapters
  const ExternalAdapters = {
    clientId,
    chainConfig,
    web3AuthNetwork: "sapphire_devnet" as WEB3AUTH_NETWORK_TYPE,
  };
  
  // Initialize Auth Adapter (formerly OpenloginAdapter)
  const authAdapter = new AuthAdapter({
    adapterSettings: {
      chainConfig: chainConfig,
      network: "sapphire_devnet" as WEB3AUTH_NETWORK_TYPE, 
      uxMode: UX_MODE.POPUP,
      mfaLevel: MFA_LEVELS.OPTIONAL,
      whiteLabel: {
        logoLight: process.env.NEXT_PUBLIC_WEB3AUTH_LOGO_URL,
        logoDark: process.env.NEXT_PUBLIC_WEB3AUTH_LOGO_URL,
        defaultLanguage: "en",
        dark: true
      }
    }
  });

  const adapters = getDefaultExternalAdapters({ options: ExternalAdapters });

  // Web3Auth Context Configuration
  export const web3AuthConfig: Web3AuthContextConfig = {
    web3AuthOptions,
    modalConfig: {
      [WALLET_ADAPTERS.AUTH]: {
        label: "auth",
        showOnModal: true,
        loginMethods: {
          google: {
            name: "google",
            showOnModal: true,
          },
          facebook: {
            name: "facebook",
            showOnModal: true,
          },
          twitter: {
            name: "twitter",
            showOnModal: true,
          }
        }
      }
    },
    adapters: [authAdapter, ...adapters]
  };
  • SDK Version(package.json):
    @web3auth/auth-adapter”: “^9.6.0”,
    @web3auth/base”: “^9.6.0”,
    @web3auth/modal”: “^9.6.0”,
    @web3auth/modal-react-hooks”: “^9.6.0”,
    @web3auth/default-solana-adapter”: “^9.6.0”,
    @web3auth/solana-provider”: “^9.6.0”,

  • Platform:

  • Framework: Next.js 13+ (App Router)

  • Web3Auth Version: v9.6.0

  • React: 18

  • TypeScript: 5.x

  • Browser Console Screenshots:


Hi Daniel,

Thanks for sharing the detailed information! It looks like you’re making a great effort to set up Web3Auth for Solana but are encountering an issue with the “Chain null not supported” error.

Issue Summary:

  • Error: WalletLoginError: Failed to connect with wallet. Chain null not supported.
  • SDK Version: 9.6.0 across several packages.
  • Platform Details: Next.js 13+, React 18, TypeScript 5.x
  • Initialization Code: Provided

Possible Solution:

The error message indicates that there’s a mismatch or misconfiguration with the chain you’re attempting to use. Your setup uses chainId: "solana:devnet" which seems correct as Devnet is supported.

Here’s what you might want to verify:

  1. Chain Config Mismatch: Ensure chainConfig is consistently supplied wherever required, especially in your adapters and auth setup.
  2. Adapter Settings: Make sure that all parts of your code which require a chainConfig actually receive the correct configuration. Double-check any case where it might not be given properly.
  3. Client ID & Network: Verify that the clientId and network settings correspond correctly to the usage with Solana’s Devnet.

Your screenshots and code snippet don’t appear to show any immediate structural issues, but it would still be beneficial to double-check the pipeline from Web3Auth initialization to adapters, ensuring coherence across all chain-related configurations.

If the above steps don’t resolve the issue, please confirm the following:

  • The clientId is correctly set up on the Web3Auth dashboard for Solana Devnet.
  • There are no network connectivity issues with https://api.devnet.solana.com.

Feel free to reach back if you’ve any more queries or if the issue persists after these checks. We’ll ensure it gets attended to by the support team promptly.

Best,
[Your Name]

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours

@smash.dchild Please enter a valid chain id
Valid chain IDs for Solana are "0x1", "0x2" and "0x3" for mainnet, devnet and testnet respectively.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.