TypeError: Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer #1471

Closed
opened 2026-04-05 19:29:42 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @SamuelBoerlin on 5/20/2025

Hi

While setting up OAuth2/OIDC I ran into the following issue:

Connecting to IdP
Validating your identity

There was a problem connecting to IdP. Please contact your administrator.
An error occurred

along with the following error log

2025-05-20T20:09:39.610Z [error]: Failed to send request
Stack: Error: Failed to send request
    at sendTokenRequest (file:///app/node_modules/arctic/dist/request.js:76:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async OAuth2Client.validateAuthorizationCode (file:///app/node_modules/arctic/dist/client.js:71:24)
    at async gg (file:///app/dist/server.mjs:31:139872)

and after adding some debug console logging

TypeError: fetch failed
    at async gg (server/routers/idp/validateOidcCallback.ts:164:23)
  162 |         }
  163 |
> 164 |         const tokens = await client.validateAuthorizationCode(
      |                       ^
  165 |             ensureTrailingSlash(existingIdp.idpOidcConfig.tokenUrl),
  166 |             code,
  167 |             codeVerifier {
  [cause]: TypeError: Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer
      at ArrayBuffer.slice (<anonymous>)

I ended up tracking this down to this request in arctic: https://github.com/pilcrowonpaper/arctic/blob/main/src/request.ts#L14-L18

All works fine if I replace that in /app/node_modules/arctic/dist/request.js with

const request = new Request(endpoint, {
    method: "POST",
    body: body.toString()
});

I will shortly open a PR in the arctic repo and hope it can be integrated here soon if it is accepted.

Using fosrl/pangolin:1.4.0

*Originally created by @SamuelBoerlin on 5/20/2025* Hi While setting up OAuth2/OIDC I ran into the following issue: ``` Connecting to IdP Validating your identity There was a problem connecting to IdP. Please contact your administrator. An error occurred ``` along with the following error log ``` 2025-05-20T20:09:39.610Z [error]: Failed to send request Stack: Error: Failed to send request at sendTokenRequest (file:///app/node_modules/arctic/dist/request.js:76:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async OAuth2Client.validateAuthorizationCode (file:///app/node_modules/arctic/dist/client.js:71:24) at async gg (file:///app/dist/server.mjs:31:139872) ``` and after adding some debug console logging ``` TypeError: fetch failed at async gg (server/routers/idp/validateOidcCallback.ts:164:23) 162 | } 163 | > 164 | const tokens = await client.validateAuthorizationCode( | ^ 165 | ensureTrailingSlash(existingIdp.idpOidcConfig.tokenUrl), 166 | code, 167 | codeVerifier { [cause]: TypeError: Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer at ArrayBuffer.slice (<anonymous>) ``` I ended up tracking this down to this request in arctic: https://github.com/pilcrowonpaper/arctic/blob/main/src/request.ts#L14-L18 All works fine if I replace that in `/app/node_modules/arctic/dist/request.js` with ``` const request = new Request(endpoint, { method: "POST", body: body.toString() }); ``` I will shortly open a PR in the arctic repo and hope it can be integrated here soon if it is accepted. Using fosrl/pangolin:1.4.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#1471