From b41dbec098c1175d5a3e2216b15377b31850b494 Mon Sep 17 00:00:00 2001 From: Jakob Wennberg Date: Mon, 24 Aug 2026 15:51:22 +0200 Subject: [PATCH] fix(build): payment-file route returns a Uint8Array body, not a Buffer (#1850) The zero-extensions build (tsconfig.build.json) rejects a Node Buffer as a Response body (TS2345: Buffer is not assignable to BodyInit), which has made every PR's Core Build red since #1845 merged. Main's push CI does not run that job, so it only surfaced on PRs. Same pattern as the PDF/XLSX report routes. Claude-Session: https://claude.ai/code/session_01ScVhg6XsDtNXkiEQNV7LaZ Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 --- .../skatteverket/tax-payments/[period]/payment-file/route.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/skatteverket/tax-payments/[period]/payment-file/route.ts b/app/api/skatteverket/tax-payments/[period]/payment-file/route.ts index 6efce6a7..8c07d728 100644 --- a/app/api/skatteverket/tax-payments/[period]/payment-file/route.ts +++ b/app/api/skatteverket/tax-payments/[period]/payment-file/route.ts @@ -218,7 +218,9 @@ export const GET = withRouteContext<{ params: Promise<{ period: string }> }>( .eq('id', agi.id) .eq('company_id', companyId) - return new Response(fileContent, { + // Buffer is not assignable to BodyInit under the strict build tsconfig + // (Buffer); the repo convention is a Uint8Array view. + return new Response(new Uint8Array(fileContent), { headers: { 'Content-Type': contentType, 'Content-Disposition': `attachment; filename="${filename}"`,