diff --git a/packages/frontend-core/src/api/attachments.ts b/packages/frontend-core/src/api/attachments.ts index 0cedfb2cf1..e680218c8f 100644 --- a/packages/frontend-core/src/api/attachments.ts +++ b/packages/frontend-core/src/api/attachments.ts @@ -100,6 +100,7 @@ export const buildAttachmentEndpoints = ( body: data, json: false, external: true, + parseResponse: response => response as any, }) return { publicUrl } }, diff --git a/packages/frontend-core/src/api/index.ts b/packages/frontend-core/src/api/index.ts index d3209e0a54..6efc90023a 100644 --- a/packages/frontend-core/src/api/index.ts +++ b/packages/frontend-core/src/api/index.ts @@ -163,13 +163,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => { } else if (parseResponse) { return await parseResponse(response) } else { - const text = await response.text() - // If the response has no body at all e.g s3.put - if (!text) { - // Empty response - return {} as ResponseT - } - return JSON.parse(text) as ResponseT + return (await response.json()) as ResponseT } } catch (error) { delete cache[url]