I implemented Google login using remix-auth-oauth2 and remix-auth-google, based on remix-on-bun by @sergiodxa . However, I encountered an "Unexpected end of JSON input" error when calling authenticator.authenticate in the callback.
Upon investigation, I found that the issue is due to the lack of Response.clone implementation in Bun. This causes an error in response.json() when getAccessToken tries to read from a cloned response created in fetchAccessToken.
While waiting for Bun to implement this might be an option, it seems unnecessary to clone the response in fetchAccessToken in the first place.
I've managed to get it working by applying the following patch on my end. Is cloning really necessary?
I implemented Google login using remix-auth-oauth2 and remix-auth-google, based on remix-on-bun by @sergiodxa . However, I encountered an "Unexpected end of JSON input" error when calling authenticator.authenticate in the callback.
Upon investigation, I found that the issue is due to the lack of Response.clone implementation in Bun. This causes an error in response.json() when getAccessToken tries to read from a cloned response created in fetchAccessToken.
While waiting for Bun to implement this might be an option, it seems unnecessary to clone the response in fetchAccessToken in the first place.
I've managed to get it working by applying the following patch on my end. Is cloning really necessary?