From 6c6559867d8a3fddc3ef2900798f4c2b6488c338 Mon Sep 17 00:00:00 2001 From: Tom Forbes Date: Mon, 9 Aug 2021 09:14:21 +0100 Subject: [PATCH] Log response body for failed identity requests (#44) * Log identity response when account creation fails * better --- src/create-reminder-signup/lib/identity.ts | 12 ++++++++---- src/lib/identity.ts | 14 ++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/create-reminder-signup/lib/identity.ts b/src/create-reminder-signup/lib/identity.ts index 7972ee9..ccba7a5 100644 --- a/src/create-reminder-signup/lib/identity.ts +++ b/src/create-reminder-signup/lib/identity.ts @@ -30,10 +30,14 @@ const createIdentityAccount = async ( IDENTITY_ACCOUNT_CREATION_MAX_RETRIES, ); if (!response.ok) { - console.log( - `Identity guest account creation failed with status ${response.status}`, - ); - return fail(response.status); + return response.text().then((body) => { + console.log( + 'Identity guest account creation failed', + response.status, + body, + ); + return fail(response.status); + }); } return response.json().then((identityResponse) => { diff --git a/src/lib/identity.ts b/src/lib/identity.ts index b181f93..d31a77e 100644 --- a/src/lib/identity.ts +++ b/src/lib/identity.ts @@ -41,12 +41,14 @@ export const getIdentityIdByEmail = async ( ); if (!response.ok) { - console.log( - `Failed to get identity ID for email ${email}`, - response.status, - response, - ); - return fail(response.status); + return response.text().then((body) => { + console.log( + `Failed to get identity ID for email ${email}`, + response.status, + body, + ); + return fail(response.status); + }); } return response.json().then((identityResponse) => {