Originally reported at https://forum.ghost.org/t/complimentary-premium-plan-return-an-error/13738/1
The only problem I have at the moment is in the complimentary Premium Plan. When I select a member, change the toggle and hit save it return this.
Internal server error, cannot edit a member. Cannot read property ‘id’ of undefined
But I’m able to add notes change the name and save just not a complimentary option.
TypeError: Cannot read property 'id' of undefined
at StripePaymentProcessor.setComplimentarySubscription (/home/ghost/node_modules/@tryghost/members-api/lib/stripe/index.js:252:45)
(Internal discussion for future reference https://ghost.slack.com/archives/C02G9E68C/p1587559818050500)
There appear to be two causes for this so far:
0 we have a hash collision with plan identifiers that results in the complimentary plan not being createdThis is in progress in this WIP PR: https://github.com/TryGhost/Members/pull/167/files
Was a little slower than I'd have liked due to looking at the new "Prices" from Stripe and trying to use that, I think it's worth it though as this cleans up a lot of things!
Closing in favour of https://github.com/TryGhost/Members/issues/168
Repro case from @kevinansfield:
My repro steps:
- change yearly pricing to 0 + save
- change currency to one not used before + save
- create a new member
- try to apply complimentary plan
Monthly/yearly plans set to zero-value isn't a valid use-case with the current plan implementation, so this can be fixed with additional validation on plan prices.
https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts <-- resource for when we do validation
The solution to this should be validating that the values are not < 1. This works for all currencies we support. There will be a larger refactor of currency support soon.
The Ghost API & Admin no longer allow creating plans with an amount of 0. So future installs/setups should not run into this problems.
We have not removed existing 0 amount plans, but they may still cause issues with Complimentary plans, the fix would be to update your plans to have an amount of 1 or more :relaxed:
This is still occuring for me on 3.27.0. Any idea ?
Plan is on 5e / month

@allouis bump ! still occuring with 3.29.1
I made sure my plan's price is > 0

@sbounmy If you think this is still a bug on the latest version, would you be able to open an issue with reproducible steps and stack traces from the errors and any other useful info? Thanks :relaxed: