Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Soft-fail logo upload so it doesn't block program creation

Kiran Kc8bde202aee6
diff --git a/apps/web/lib/actions/partners/create-program.ts b/apps/web/lib/actions/partners/create-program.ts
index 01730977fe..20ca4ac44e 100644
--- a/apps/web/lib/actions/partners/create-program.ts
+++ b/apps/web/lib/actions/partners/create-program.ts
@@ -86,14 +86,20 @@ export const createProgram = async ({
const programId = createId({ prefix: "prog_" });
- const logoUrl = uploadedLogo
- ? await storage
- .upload({
- key: `programs/${programId}/logo_${nanoid(7)}`,
- body: uploadedLogo,
- })
- .then(({ url }) => url)
- : null;
+ let logoUrl: string | null = null;
+
+ if (uploadedLogo) {
+ try {
+ const { url } = await storage.upload({
+ key: `programs/${programId}/logo_${nanoid(7)}`,
+ body: uploadedLogo,
+ });
+
+ logoUrl = url;
+ } catch (error) {
+ console.error(`Failed to upload program logo for ${programId}`, error);
+ }
+ }
// create a new program
const program = await prisma.$transaction(async (tx) => {