diff --git a/web/netlify/functions/update-settings.ts b/web/netlify/functions/update-settings.ts index b4ae3fea9..7ab0ca0da 100644 --- a/web/netlify/functions/update-settings.ts +++ b/web/netlify/functions/update-settings.ts @@ -6,7 +6,7 @@ const SUPABASE_URL = process.env.SUPABASE_URL; const supabase = createClient(SUPABASE_URL!, SUPABASE_KEY!); export const uploadSettingsToSupabase = async function (event: any, context: any) { try { - const { message, address, signature } = event.body; + const { message, address, signature } = JSON.parse(event.body); const email = message.replace(/\n|\r/g, "").split("Email:").pop().split("Nonce:")[0].trim(); const nonce = message.split("Nonce:").pop().trim(); console.log( diff --git a/web/src/utils/uploadSettingsToSupabase.ts b/web/src/utils/uploadSettingsToSupabase.ts index 7c5c964e7..225b09284 100644 --- a/web/src/utils/uploadSettingsToSupabase.ts +++ b/web/src/utils/uploadSettingsToSupabase.ts @@ -2,10 +2,12 @@ import { toast } from "react-toastify"; import { OPTIONS } from "utils/wrapWithToast"; export function uploadSettingsToSupabase(formData: any): Promise { + console.log("formdata", formData); + console.log("stringified formdata", JSON.stringify(formData)); return toast.promise( fetch("./netlify/functions/update-settings", { method: "POST", - body: formData, + body: JSON.stringify(formData), }).then(async (response) => { if (response.status !== 200) { const error = await response.json().catch(() => ({ message: "Error uploading to Supabase" }));