Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recursion(no pun intended) with BillingInfo.account_code #90

Open
bradodarb opened this issue Mar 1, 2019 · 0 comments
Open

Comments

@bradodarb
Copy link

bradodarb commented Mar 1, 2019

When serializing an instance of BillingInfo, a RangeError will be encountered due to the following code:
https://github.com/ceejbot/recurring/blob/master/lib/models/billing-info.js#L53

The class is creating a property getter that points to itself.

An error similar to the following is produced:

"err": {
    "message": "Maximum call stack size exceeded",
    "name": "RangeError",
    "stack": "RangeError: Maximum call stack size exceeded\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:52:43)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)\n    at BillingInfo.__defineGetter__ [as account_code] (/var/task/node_modules/recurring/lib/models/billing-info.js:53:19)"
  }

Looks like

 this.__defineGetter__('account_code', () => {
      return this.account_code
    })

Should be

 this.__defineGetter__('account_code', () => {
      return this.properties.account_code
    })

Happy to send a PR if this repo is still active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant