Freecodecamp: PayPal called during development

Created on 5 May 2020  路  5Comments  路  Source: freeCodeCamp/freeCodeCamp

Describe the bug
The PayPal sdk gets called by the local site, even when there are no keys specified in .env

To Reproduce
Steps to reproduce the behavior:

  1. Go to any page with a donation component
  2. Open the console
  3. See a 400 error

Expected behavior
If the keys are missing, PayPal should not be contacted.

Screenshots
image

help wanted client bug

Most helpful comment

@UgRoss, it should happen if you hard refresh on donation page. (and on donation modal)
That script loads the button.
A solution would be to check for paypalClientId in the render of PaypalButton component and return PayPalButtonScriptLoader only if paypalClientId is truthy.

All 5 comments

/cc @ahmadabdolsaheb 馃し

Hello guys!
Does this happen on /donate page or somewhere else too?

I noticed that this page fails to load also because of the missing Stripe API key for me. Can't recreate it anymore, happend only once.

I'd like to help with that issue if you don't mind

Also, I noticed PaypalButton has a typo clinetId -> clientId in props, example: https://github.com/freeCodeCamp/freeCodeCamp/blob/master/client/src/components/Donation/PaypalButton.js#L82

@UgRoss, it should happen if you hard refresh on donation page. (and on donation modal)
That script loads the button.
A solution would be to check for paypalClientId in the render of PaypalButton component and return PayPalButtonScriptLoader only if paypalClientId is truthy.

PR is ready. Could you please take a look?

Also about the Stripe issue. I'm not sure if it's expected/known but if I don't configure the key for stripe, the /donate page isn't loading for me at all.
CleanShot 2020-05-11 at 02 59 29@2x

Yikes, that seems like it needs a fix as well. Thanks for catching that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kokushozero picture kokushozero  路  3Comments

vaibsharma picture vaibsharma  路  3Comments

MelissaManning picture MelissaManning  路  3Comments

robwelan picture robwelan  路  3Comments

ar5had picture ar5had  路  3Comments