The modal does not load and just spins

Basically I have a react app and an express backend api:
On localhost everything works. However when I deploy it it does not load the modal when i click on the login screenshot: Screenshot 2023-03-22 at 4.49.38 PM.png - Google Drive

environemnt variable config for the deployed environment:
NODE_ENV=production
REACT_APP_BASE_URL=
REACT_APP_CHAIN_ID=0x5 (for goerli)
REACT_APP_RPCTARGET=https://goerli.infura.io/v3/a……b (using infura)

  • SDK Version: “@walletconnect/web3-provider”: “^1.7.8”,
    @web3auth/web3auth”: “^1.1.1”,
  • Platform: react/ web
  • Browser Console Screenshots: chrome

Please provide the Web3Auth initialization and login code snippet below:

type or paste code here

import { Web3Auth } from “@web3auth/web3auth”;
import { CHAIN_NAMESPACES } from “@web3auth/base”;
import Web3 from “web3”;
import {createAndLoginUser} from ‘…/networking/user’

const config = require(‘…/config/config’)[process.env.NODE_ENV || ‘development’];

let web3auth;
const clientId = config.clientId;
const init = async () => {
try {
web3auth = new Web3Auth({
// type uiConfig
uiConfig: {
appLogo: config.appLogo,
theme: “dark”,
loginMethodsOrder: [“google”, “facebook”],
defaultLanguage: “en”,
},
clientId,
chainConfig: { // this is ethereum chain config, change if other chain(Solana, Polygon)
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: config.chainId,
rpcTarget: config.rpcTarget,
}
});

        await web3auth.initModal();
        if (web3auth.provider) {
        };
      } catch (error) {
        console.error(error);
      }
    };

init();
export const connectWallet = async () => {
if (!web3auth) {
console.log(“web3auth not initialized yet”);
return;
}
const provider = await web3auth.connect();
// if provider is not null then user logged in successfully
if(provider != null){
console.log(‘User logged in successfully.’);
}
const web3 = new Web3(provider);
const userAccounts = await web3.eth.getAccounts();
console.log(userAccounts);
const user = await web3auth.getUserInfo();
const address = userAccounts[0];
user.address=address;
return await createAndLoginUser(user).then(res => {
return res;
})
}

export const disconnnectWallet = async () => {
if (!web3auth) {
console.log(“web3auth not initialized yet”);
return;
}
try{
await web3auth.logout();
}catch(error){

  }

}

I think there is some down time right now

Hey @bhargav

Please provide the browser console logs, the screenshot provided is of loading Modal only.

Also, looks like you’re using a deprecated package. Please use the latest package, @web3auth/modal: ^5.0.1.

We have an up-to-date React EVM example https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/web-modal-sdk/blockchain-connection-examples/evm-modal-example

No, there wasn’t. Here, @bhargav is using a deprecated package.

Please check https://status.web3auth.io/ for any outages in the future.

Here are the console logs:

You are not logged in
react_devtools_backend.js:2655 TypeError: Cannot convert a BigInt value to a number
    at Math.pow (<anonymous>)
    at 747 (uint.ts:10:22)
    at u ((index):5:900)
    at 719 (1.a639ee1e.chunk.js:2:205382)
    at u ((index):5:900)
    at 718 (ssz.ts:1:1)
    at u ((index):5:900)
    at 707 (1.a639ee1e.chunk.js:2:182159)
    at u ((index):5:900)
    at Object.<anonymous> (1.a639ee1e.chunk.js:2:30512)
overrideMethod @ react_devtools_backend.js:2655
(anonymous) @ interact.js:32
d @ regeneratorRuntime.js:44
(anonymous) @ regeneratorRuntime.js:125
(anonymous) @ regeneratorRuntime.js:69
r @ asyncToGenerator.js:3
c @ asyncToGenerator.js:25
Promise.then (async)
r @ asyncToGenerator.js:12
s @ asyncToGenerator.js:22
(anonymous) @ asyncToGenerator.js:27
(anonymous) @ asyncToGenerator.js:19
(anonymous) @ interact.js:10
447 @ interact.js:35
u @ (index):5
t @ (index):5
r @ (index):5
(anonymous) @ main.875e46b8.chunk.js:1
AppContext.jsx:54 You are not logged in

I am going to try to remove the old packages and add the new ones. And refactor the code like in the email repo.

Please see this Big Int error in React production build? to fix it. You will need to update your package.json file.

This worked thank you!

1 Like