Skip to content

Commit eacd784

Browse files
committed
api: ignore failures from thirdweb getUser feature
1 parent b5ea4bf commit eacd784

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

apps/api/src/routes/auth.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { FastifyPluginAsync } from "fastify";
77

88
import "../middleware/chain";
99
import "../middleware/swagger";
10-
import { getUser } from "thirdweb";
10+
import { type GetUserResult, getUser } from "thirdweb";
1111
import type {
1212
LoginBody,
1313
LoginReply,
@@ -119,14 +119,20 @@ export const authRoutes =
119119

120120
if (adminAddress) {
121121
// Look up any associated user details in the embedded wallet
122-
const thirdwebUser = await getUser({
123-
client,
124-
ecosystem: {
125-
id: env.THIRDWEB_ECOSYSTEM_ID,
126-
partnerId: env.THIRDWEB_ECOSYSTEM_PARTNER_ID,
127-
},
128-
walletAddress: adminAddress,
129-
});
122+
let thirdwebUser: GetUserResult | null | undefined;
123+
try {
124+
thirdwebUser = await getUser({
125+
client,
126+
ecosystem: {
127+
id: env.THIRDWEB_ECOSYSTEM_ID,
128+
partnerId: env.THIRDWEB_ECOSYSTEM_PARTNER_ID,
129+
},
130+
walletAddress: adminAddress,
131+
});
132+
} catch {
133+
// Ignore failures from the Thirdweb SDK, this info is "nice-to-have"
134+
}
135+
130136
if (thirdwebUser) {
131137
const email = parseThirdwebUserEmail(thirdwebUser);
132138
if (email) {

0 commit comments

Comments
 (0)