intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
119 stars 153 forks source link

4.1.0 throws TypeError: Converting Circular structure to JSON #161

Closed amadeogallardo closed 3 months ago

amadeogallardo commented 4 months ago

The following error is thrown by the latest version of the OAuth Client:

TypeError: Converting circular structure to JSON --> starting at object with constructor 'ClientRequest' | property 'res' -> object with constructor 'IncomingMessage' --- property 'req' closes the circle at JSON.stringify () intuit-oauth\src\OAuthClient.js:405:66

ysageev commented 4 months ago

Same problem. Now I'm having trouble reverting to 4.0.0 as well.

rajeshgupta723 commented 4 months ago

Thank you @amadeogallardo and @ysageev , I've created a new branch from the master, called release-4.1.1 and raised this PR: https://github.com/intuit/oauth-jsclient/pull/160

Please verify if this PR fixes the issue. If all looks good, will merge this PR into master later this week. Thanks

amadeogallardo commented 4 months ago

Thank you @rajeshgupta723, I will wait for the patch release to be tagged and then upgrade the dependency to confirm the fix.

ysageev commented 4 months ago

Yes, a tagged patch release would be more convenient for me as well.

rajeshgupta723 commented 4 months ago

Thank you @amadeogallardo and @ysageev -- a patch release 4.1.1 has been created. https://github.com/intuit/oauth-jsclient/releases/tag/4.1.1

laurentjacob commented 4 months ago

@rajeshgupta723 Can you publish a new version on npm as well? Latest is still 4.1.0

ysageev commented 3 months ago

Thank you @rajeshgupta723.

I copied the OAuthClient source directly into my project, removed the package.json entry, added your dependencies, built it, and... it runs great!

I successfully authenticated, retrieved company info, and uploaded an invoice. 🙏

rajeshgupta723 commented 3 months ago

Thank you @laurentjacob and @ysageev , appreciate your support! latest npm has been relased: https://www.npmjs.com/package/intuit-oauth/v/4.1.1

ianberryman commented 3 months ago

Hi, I'm seeing the same error in 4.1.1 when calling refreshUsingToken. I only looked briefly but it appears that it might be an issue anytime JSON.stringify(authResponse, ...) is called.

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'ClientRequest'
    |     property 'socket' -> object with constructor 'TLSSocket'
    --- property '_httpMessage' closes the circle
    at JSON.stringify (<anonymous>)
    at ...\node_modules\intuit-oauth\src\OAuthClient.js:274:14