Skip to content

Error inside of getWebidFromTokenPayload when using node 16 #3004

Description

@elf-pavlik

Impacted package

Which packages do you think might be impacted by the bug ?

  • solid-client-authn-browser
  • solid-client-authn-node
  • solid-client-authn-core
  • oidc-client-ext
  • Other (please specify): ...

Bug description

This only happens with node 16, pinning node to 18 solves the problem in our case

To Reproduce

@jeswr it might be a bit complicated, but I'm available for a LiveShare session in (VScode) to show it in the debugger using my local setup.

https://github.com/janeirodigital/sai-js

  1. start CSS in css-storage-fixture package
  2. start redis docker run --name sai-redis -p 6379:6379 -d redis
  3. start the service in service package with yarn debug
  4. attach to the process with the debugger and set to break on exceptions
  5. start the frontend https://github.com/elf-pavlik/sai-impl-web
  6. open http://localhost:4200 and Login into the frontend
  7. click Connect Server to Login into the backend/service

Expected result

Solid-OIDC OP should redirect to the backend

Actual result

The backend is not responding so the redirect is pending

Environment

Please run

npx envinfo --system --npmPackages --binaries --npmGlobalPackages --browsers

in your project folder and paste the output here:

$ npx envinfo --system --npmPackages --binaries --npmGlobalPackages --browsers


  System:
    OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 24.33 GB / 31.24 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 16.20.1 - ~/.volta/tools/image/node/16.20.1/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 8.19.4 - ~/.volta/tools/image/node/16.20.1/bin/npm
  npmPackages:
    @janeirodigital/sai-api-messages: ^0.10.0 => 0.10.0 
  npmGlobalPackages:
    corepack: 0.17.0
    npm: 8.19.4

Additional information

Looking at the call stack it looks that errors inside of getWebidFromTokenPayload -> fetchJwks in @inrupt/solid-client-authn-core

Exception has occurred: TypeError: ReadableStream.prototype.pipeTo's first argument must be a WritableStream
  at ReadableStream.pipeTo (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/web-streams-ponyfill/dist/polyfill.js:1681:29)
    at ReadableStream.pipeThrough (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/web-streams-ponyfill/dist/polyfill.js:1669:26)
    at fetchFinale (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/undici/lib/fetch/index.js:973:52)
    at mainFetch (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/undici/lib/fetch/index.js:773:5)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
pipeTo (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/web-streams-ponyfill/dist/polyfill.js:1681)
pipeThrough (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/web-streams-ponyfill/dist/polyfill.js:1669)
fetchFinale (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/undici/lib/fetch/index.js:973)
mainFetch (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/undici/lib/fetch/index.js:773)
processTicksAndRejections (internal/process/task_queues:96)
async function (Unknown Source:0)
fetching (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/undici/lib/fetch/index.js:517)
fetch (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/undici/lib/fetch/index.js:245)
fetch (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/undici/index.js:107)
fetchJwks (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/@inrupt/solid-client-authn-core/dist/index.js:71)
getWebidFromTokenPayload (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/@inrupt/solid-client-authn-core/dist/index.js:85)
handle (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/@inrupt/solid-client-authn-node/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js:79)
async function (Unknown Source:0)
handle (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/@inrupt/solid-client-authn-core/dist/index.js:55)
processTicksAndRejections (internal/process/task_queues:96)
async function (Unknown Source:0)
ClientAuthentication.handleIncomingRedirect (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/@inrupt/solid-client-authn-node/dist/ClientAuthentication.js:57)
Session.handleIncomingRedirect (/home/elf-pavlik/code/solid/sai/sai-js/node_modules/@inrupt/solid-client-authn-node/dist/Session.js:57)
handleAsync (/home/elf-pavlik/code/solid/sai/sai-js/packages/service/src/handlers/login-redirect-handler.ts:28)
processTicksAndRejections (internal/process/task_queues:96)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions