Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

client-oauth breaks on Edge runtime because of window.btoa #206

Open
korsvanloon opened this issue Feb 1, 2023 · 0 comments
Open

client-oauth breaks on Edge runtime because of window.btoa #206

korsvanloon opened this issue Feb 1, 2023 · 0 comments

Comments

@korsvanloon
Copy link

The Edge runtime neither has access to Buffer nor window. It does however has access to btoa directly.

I'm using it in my NextJS middleware that runs on the Edge middleware

If I change it like this it works fine for me. And I don't think it'll break any other scenario, right?

- var btoa
if (typeof Buffer === 'function') {
  btoa = btoaBuffer
+ } else if(typeof window !== 'undefined') {
  btoa = window.btoa.bind(window)
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant