Skip to content

Commit 11f5ace

Browse files
committed
fix: api key fallback
1 parent 0c7c5d0 commit 11f5ace

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web/netlify/functions/authUser.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ const authUser = async (event) => {
7474
}
7575

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

0 commit comments

Comments
 (0)