Ghost: Error when applying complimentary plan to member

Created on 22 Apr 2020  Â·  10Comments  Â·  Source: TryGhost/Ghost

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)

bug members / mega

All 10 comments

There appear to be two causes for this so far:

  1. If the monthly/yearly price is set to 0 we have a hash collision with plan identifiers that results in the complimentary plan not being created
  2. Something within the upgrade process resulting in the complimentary plan not being created

This 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!

Repro case from @kevinansfield:

My repro steps:

  1. change yearly pricing to 0 + save
  2. change currency to one not used before + save
  3. create a new member
  4. 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
Image of screensot

@allouis bump ! still occuring with 3.29.1

I made sure my plan's price is > 0
Screenshot 2020-08-18 at 10 45 46

@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:

Was this page helpful?
0 / 5 - 0 ratings