0

Issue: I created a new Stripe account and connected it to my application, did all the new test publishing and secret api keys... Added to my credentials and config.

All of my keys are successfully called with :

Rails.application.credentials.dig(:stripe, :publishable_key),

...in both config and stripe.js file

I update my keys in credentials and make a test payment and get

No such token: tok_1EKxxxxxxxxxxxhQKy

I then manually put in the new publishable key in the stripe.js file, and it works...

To test, I tried entering the old test key, and i get the same errors. So i am assuming the credentials dig is getting my old keys because its the same error?

Is it possible the credentials is somehow not updating?

Now, one issue i can think of is, in the past i used atom to update my credentials, and it never worked. I recently came across a post hat atom doesn't work with credentials but nano does. So i implemented this and it worked (up until i entered new keys in). So i am wondering if my old inputs into the old atom credentials could be interfering? I doubt it but might be worth mentioning

What could be done to fix this as i want to implement using credentials?

All of the keys are test keys and in their right places. I'm assuming, in the stripe.js file, the credentials or the dig is only fetching the old key?

Because when i manually put in the old test key, it doesn't work with same error as the credentials dig.

This was all working fine until i updated the credentials for the new keys...

uno
  • 1,421
  • 12
  • 38
  • Did you restart your Rails application after changing the credentials? – spickermann Mar 31 '19 at 20:52
  • 1
    Yes, many times. I retried the process about 3 times. – uno Mar 31 '19 at 21:16
  • 1
    Very possibly something going on with client-side caching. Try clearing your local cache(rake tmp:cache:clear), try it in an incognito window, etc. – Jon Mar 31 '19 at 21:25
  • @Jon hey thanks! So, this worked locally but heroku is didn't. I tried using "heroku rake tmp:cache:clear" and it generated but wouldn't work. I also restarted the dynos as well. Any way to imitate this for heroku? – uno Mar 31 '19 at 22:19
  • Also ran `heroku rake tmp:clear` still same issues.... all attempted through incognito..what else can we try? – uno Mar 31 '19 at 22:31
  • Sorry, I don't know much about Heroku, I would try the things listed in the first answer here though: https://stackoverflow.com/questions/32251719/rails-clear-cache-on-heroku. – Jon Mar 31 '19 at 22:35
  • Hm, yeah thanks. I actually tried the answers from that SO post and unfortunately none of them worked for heroku. – uno Mar 31 '19 at 22:44
  • 1
    So this worked: https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache ---- thanks for putting me on the right track @Jon – uno Mar 31 '19 at 22:54

1 Answers1

1

Spring cached credentials file.

Run this command:

spring stop
Abel
  • 3,989
  • 32
  • 31