Skip to content

Commit

Permalink
api: ignore failures from thirdweb getUser feature
Browse files Browse the repository at this point in the history
  • Loading branch information
alecananian committed Oct 10, 2024
1 parent b5ea4bf commit eacd784
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions apps/api/src/routes/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { FastifyPluginAsync } from "fastify";

import "../middleware/chain";
import "../middleware/swagger";
import { getUser } from "thirdweb";
import { type GetUserResult, getUser } from "thirdweb";
import type {
LoginBody,
LoginReply,
Expand Down Expand Up @@ -119,14 +119,20 @@ export const authRoutes =

if (adminAddress) {
// Look up any associated user details in the embedded wallet
const thirdwebUser = await getUser({
client,
ecosystem: {
id: env.THIRDWEB_ECOSYSTEM_ID,
partnerId: env.THIRDWEB_ECOSYSTEM_PARTNER_ID,
},
walletAddress: adminAddress,
});
let thirdwebUser: GetUserResult | null | undefined;
try {
thirdwebUser = await getUser({
client,
ecosystem: {
id: env.THIRDWEB_ECOSYSTEM_ID,
partnerId: env.THIRDWEB_ECOSYSTEM_PARTNER_ID,
},
walletAddress: adminAddress,
});
} catch {
// Ignore failures from the Thirdweb SDK, this info is "nice-to-have"
}

if (thirdwebUser) {
const email = parseThirdwebUserEmail(thirdwebUser);
if (email) {
Expand Down

0 comments on commit eacd784

Please sign in to comment.