Skip to content

Commit

Permalink
fix: api key fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybuidl committed Jul 4, 2024
1 parent 0c7c5d0 commit 11f5ace
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/netlify/functions/authUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ const authUser = async (event) => {
}

try {
// If the main Alchemy API key is permissioned, it won't work in a Netlify Function so we use a dedicated API key
const alchemyApiKey = process.env.ALCHEMY_FUNCTIONS_API_KEY ?? process.env.ALCHEMY_API_KEY;
const alchemyChain = isProductionDeployment() ? "arb-mainnet" : "arb-sepolia";
const alchemyRpcURL = `https://${alchemyChain}.g.alchemy.com/v2/${process.env.ALCHEMY_FUNCTIONS_API_KEY}`;
const alchemyRpcURL = `https://${alchemyChain}.g.alchemy.com/v2/${alchemyApiKey}`;
const provider = new ethers.providers.JsonRpcProvider(alchemyRpcURL);
await siweMessage.verify({ signature, nonce: nonceData.nonce, time: new Date().toISOString() }, { provider });
} catch (err) {
Expand Down

0 comments on commit 11f5ace

Please sign in to comment.