When asking for help in this category, please make sure to provide the following details:
- SDK Version: 9.5.0
- Platform: SFA - NodeJS
- Browser Console Screenshots: NA
- If the issue is related to Custom Authentication, please include the following information (optional):
- Verifier Name: sliver-firebase-auth-test
- JWKS Endpoint: https://www.googleapis.com/service_accounts/v1/jwk/firebase-adminsdk-djs67@tbdzabn8uv-d33a0.iam.gserviceaccount.com
- Sample idToken (JWT): eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2lkZW50aXR5dG9vbGtpdC5nb29nbGVhcGlzLmNvbS9nb29nbGUuaWRlbnRpdHkuaWRlbnRpdHl0b29sa2l0LnYxLklkZW50aXR5VG9vbGtpdCIsImlhdCI6MTc0OTUyOTQ2NiwiZXhwIjoxNzQ5NTMzMDY2LCJpc3MiOiJmaXJlYmFzZS1hZG1pbnNkay1kanM2N0B0YmR6YWJuOHV2LWQzM2EwLmlhbS5nc2VydmljZWFjY291bnQuY29tIiwic3ViIjoiZmlyZWJhc2UtYWRtaW5zZGstZGpzNjdAdGJkemFibjh1di1kMzNhMC5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInVpZCI6InFjSTlmMnpER1hNaEZLeEw0SGhHeVVVaGVyNzMiLCJjbGFpbXMiOnsicmFuZG9tVVVJRCI6IjYxMjA2ZDZjLWZlODctNDdjZi04MGM5LTFhNjk1Y2NhNjY5NyJ9fQ.uppWhECoEbmDt-SHYdlb2YYDA_s8Uvt2zXKBQSMBFKrtE4kds1KzJ19HhAkBkBlOAX4lKmWe1_fKAVi7PzEgi2GGXZojcz7hja33-pdvh3j0ENCInlBFLM2G2vr7i9m4XRI6g_52OGlgzDCtYHvesrJHxxMU58UYwKB_fz9iy1PaSNRrW8CLCX264aHpL92os8E1I4PQnAhD8d9V_nogfzkECESCIgH38a_joaJBO4BG4_ipLkpaJ–TE5Sx9SUwZIjuVkvQhBEMdpAMTQNBNDnDiQLDP2gSh6v1f4AYHSIZx8BlK-V6TKuXe4z6VbfQHM2_DM-U_n_-sXTSISzoEw
Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.
Code
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x1",
rpcTarget: config.MAINNET_RPC_URL,
displayName: "Mainnet",
ticker: "ETH",
tickerName: "Ethereum",
};
const chainConfigBatch = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x1",
rpcTarget: config.MAINNET_BATCH_RPC_URL,
displayName: "Mainnet",
ticker: "ETH",
tickerName: "Ethereum",
};
const privateKeyProviderMain = new EthereumPrivateKeyProvider({ config: { chainConfig } });
const privateKeyProviderBatch = new EthereumPrivateKeyProvider({ config: { chainConfig: chainConfigBatch } });
const CACHE = new ExpiringCache<string>();
export const populateWallets = async (req: Request, resp: Response, next: NextFunction) => {
try {
const userId = (req.user as any).uid;
let privateKey = null;
for (const privateKeyProvider of [privateKeyProviderMain, privateKeyProviderBatch]) {
try {
let newToken = await auth().createCustomToken(userId, {
randomUUID: randomUUID()
});
console.log(newToken);
const web3auth = new Web3Auth({
clientId: config.WEB3AUTH_CLIENT_ID,
web3AuthNetwork: config.WEB3AUTH_NETWORK as TORUS_NETWORK_TYPE, // Get your Network ID from Web3Auth Dashboard
privateKeyProvider,
mode: SDK_MODE.NODE
});
await web3auth.init();
const web3AuthProvider = await web3auth.connect({
verifier: config.WEB3AUTH_VERIFIER, // replace with your verifier name
verifierId: userId, // replace with your verifier id's value, for example, sub value of JWT Token, or email address.
idToken: newToken, // replace with your newly created unused JWT Token.
});
privateKey = await web3AuthProvider?.request({ method: "eth_private_key" }) as string;
break;
}
catch (e) {
logger.error(`Failed to get auth from web3auth for url ${privateKeyProvider.config.chainConfig.rpcTarget}`, e);
continue;
}
}
if (privateKey == null) {
throw "Failed to get auth from web3auth";
}
let signer = privateKeyToAccount(("0x" + privateKey) as Hex);
(req.user as any).smartAccountClients = {};
for (let chain of config.SUPPORTED_CHAINS) {
const account = await signerToSafeSmartAccount(publicClients[chain.name.toLowerCase()], {
signer,
entryPoint: ENTRYPOINT_ADDRESS_V07, // global entrypoint
safeVersion: "1.4.1",
});
logger.debug(`Smart account address for chain ${chain.name.toLowerCase()}: ${account.address}`);
const smartAccountClient = createSmartAccountClient({
account,
chain,
entryPoint: ENTRYPOINT_ADDRESS_V07,
bundlerTransport: http(config.CHAIN_CONFIG[chain.name.toLowerCase()].bundler),
middleware: {
sponsorUserOperation: paymasterClients[chain.name.toLowerCase()].sponsorUserOperation, // optional
gasPrice: async () => (await pimlicoBundlerClients[chain.name.toLowerCase()].getUserOperationGasPrice()).fast, // if using pimlico bundler
}
});
(req.user as any).smartAccountClients[chain.name.toLowerCase()] = smartAccountClient;
}
(req.user as any).stellarKeyPair = await getStellarKeyPair(privateKey);
next();
} catch (e) {
logger.error("Error populating wallets", e);
throw e;
}
}
Error Logs:
This is happening for userId: qcI9f2zDGXMhFKxL4HhGyUUher73
[1] Response: 504 Gateway Timeout
[1] Url: https://node-1.dev-node.web3auth.io/sss/jrpc
[1] {"severity":"ERROR","message":"Failed to get auth from web3auth for url https://slivertestnet.duckdns.org Error: Error occurred while getting current epoch\n at /Users/peeyushaggarwal/Work/new-sliver/sliver-backend/node_modules/@web3auth/single-factor-auth/node_modules/@toruslabs/torus.js/dist/lib.cjs/some.js:83:20\n at <anonymous>\n at processTicksAndRejections (node:internal/process/task_queues:105:5)"}
but working for xQpNrpB8c7bRR1OHUSmUQfGnyTT2 and V8muXiqSQMhGXq2LwrFW67P4jfV2. Though I am seeing quite a lot of errors like this but functionality is still workinf.
[1] Response: 504 Gateway Timeout
[1] Url: https://node-1.dev-node.web3auth.io/sss/jrpc
Please any help is appreciated. this is blocking my development.