Closed paulius-valiunas closed 1 month ago
sorry, I had to make a few changes to the original description. There was an error on my part, I thought it worked with an older version but it appears it was due to a different dev environment. Still, I would like to start a discussion around possibly using this package in a Node.js + puppeteer/playwright environment. It works fine on Node.js 18 but not on any older versions.
Why not injecting a global mocked fetch
in your test code?
I'd like to keep the testing environment clean and close to production environment - you never know when some other dependency starts using fetch
, and my tests would pass because of the polyfill but production code would fail. It is an option I'm considering, just not ideal.
This issue (question) staled some time ago, closing it for now.
We use this package for integration testing, where we use
playwright
to get a user token using the authorization code grant. We then pass the response toOidcClient.processSigninResponse
on the Node.js side (playwright doesn't allow dynamically importing packages in the web browser context). This works with Node.js 18 but not with older versions because they don't havefetch
implementation. We were able to fix one such occurrence on our end by passing issuer metadata into theOidcClient
constructor. However, it looks like this might be a more common problem than we thought.Would it be possible to make a code path compatible with non-browser environments?
Here is the stack trace: