From 1e1ed880d4470d6ffe2ab4ab3fb13b28e6f983eb Mon Sep 17 00:00:00 2001 From: Dominik Stumpf <122315398+dominik-stumpf@users.noreply.github.com> Date: Wed, 9 Oct 2024 23:44:09 +0200 Subject: [PATCH] fix: remove old neynar api call (#1520) * fix: remove old neynar api call * fix: add back neynar request with correct domain * chore: use url from vercel env --- .env | 3 ++- src/app/(marketing)/profile/[username]/page.tsx | 8 ++++++-- src/env.js | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 9db72292fb..e11b1598af 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ NEXT_PUBLIC_API=https://api.guild.xyz/v1 +NEXT_PUBLIC_URL=https://$NEXT_PUBLIC_VERCEL_URL NEXT_PUBLIC_DISCORD_CLIENT_ID=868172385000509460 NEXT_PUBLIC_IPFS_GATEWAY=https://guild-xyz.mypinata.cloud/ipfs/ NEXT_PUBLIC_PINATA_API=https://api.pinata.cloud @@ -10,4 +11,4 @@ NEXT_PUBLIC_POSTHOG_KEY=phc_Pu6Xv72B95fHVTAKT5Xs2FPgNxrsNP4LecBqPiVAAxi NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=d851f25304d67fc8e2dd3b354223e4fa NEXT_PUBLIC_EDGE_CONFIG_ID=ecfg_buc5l6124c4koymyvseasbd1k3hs NEXT_PUBLIC_RECAPTCHA_SITE_KEY=6LcQm4onAAAAAOcoqkw9A5txg5SbuddONchMZKrF -NEXT_PUBLIC_BUGSNAG_KEY=4bd5799ac2cb4a34887513b80b845554 \ No newline at end of file +NEXT_PUBLIC_BUGSNAG_KEY=4bd5799ac2cb4a34887513b80b845554 diff --git a/src/app/(marketing)/profile/[username]/page.tsx b/src/app/(marketing)/profile/[username]/page.tsx index e3f9169cce..0d3151dff6 100644 --- a/src/app/(marketing)/profile/[username]/page.tsx +++ b/src/app/(marketing)/profile/[username]/page.tsx @@ -81,7 +81,11 @@ const fetchPublicProfileData = async ({ ) const fcProfile = farcasterProfiles.at(0) const neynarRequest = - fcProfile && new URL(`${NEYNAR_BASE_URL}/user/bulk?fids=${fcProfile.fid}`) + fcProfile && + new URL( + `${NEYNAR_BASE_URL}/user/bulk?fids=${fcProfile.fid}`, + env.NEXT_PUBLIC_URL + ) const fcFollowers = neynarRequest && (await ssrFetcher(neynarRequest, { @@ -202,7 +206,7 @@ const fetchPublicProfileData = async ({ [profileRequest.pathname, profile], [contributionsRequest.pathname, contributions], [farcasterProfilesRequest.pathname, farcasterProfiles], - [neynarRequest?.href, fcFollowers], + [neynarRequest?.pathname, fcFollowers], [referredUsersRequest.pathname, referredUsers], [experiencesRequest.pathname, experiences], [ diff --git a/src/env.js b/src/env.js index d451b3ed6e..9413329685 100644 --- a/src/env.js +++ b/src/env.js @@ -30,6 +30,7 @@ export const env = createEnv({ // Guild APIs NEXT_PUBLIC_API: z.string(), NEXT_PUBLIC_BALANCY_API: z.string(), + NEXT_PUBLIC_URL: z.string(), // Captcha NEXT_PUBLIC_RECAPTCHA_SITE_KEY: z.string(), @@ -51,6 +52,10 @@ export const env = createEnv({ }, runtimeEnv: { NEXT_PUBLIC_API: process.env.NEXT_PUBLIC_API, + NEXT_PUBLIC_URL: + process.env.NODE_ENV === "production" + ? process.env.NEXT_PUBLIC_URL + : "http://127.0.0.1:3000", NEXT_PUBLIC_BALANCY_API: process.env.NEXT_PUBLIC_BALANCY_API, NEXT_PUBLIC_RECAPTCHA_SITE_KEY: process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY,