Open real-ashwin opened 9 years ago
You need to set the MAILCHIMP_API_KEY and STRIPE_API_KEY values in either your Unix ENV variables or the config/secrets.yml file.
Hey Daniel, Thanks for the quick reply but unfortunately that did not fix it :( ..
Open terminal and at the command line $> source ~/.bash_profile or ~/.profile. at the command prompt and type `echo $MAILCHIMP_API_KEY - or any of the keys in question. if you see the key you specified. restart rails.
I can see the key but the error still exists . On May 29, 2015 12:09 AM, "Orion Engleton" notifications@github.com wrote:
Open terminal and at the command line $> source ~/.bash_profile or ~/.profile. at the command prompt and type `echo $MAILCHIMP_API_KEY if you see the key you specified. restart rails.
— Reply to this email directly or view it on GitHub https://github.com/RailsApps/rails-stripe-membership-saas/issues/143#issuecomment-106718497 .
I'm getting the same error cant find the issue myself .. this is after doing a search and commenting out all blocks of code where I see Rails.application.secrets.whatever_key , in the initializers - in the user model in the secrets.yml. Just to get the first initial migration going.
$> rake db:migrate
rake aborted!
KeyError: key not found: "MAILCHIMP_API_KEY" (erb):20:in `fetch' (erb):20:in
In your config/secrets.yml file, replace the following:
mailchimp_api_key: <%= ENV.fetch("MAILCHIMP_API_KEY") %>
mailchimp_list_id: <%= ENV.fetch("MAILCHIMP_LIST_ID") %>
stripe_api_key: <%= ENV.fetch("STRIPE_API_KEY") %>
stripe_publishable_key: <%= ENV.fetch("STRIPE_PUBLISHABLE_KEY") %>
with:
mailchimp_api_key: yourkey
mailchimp_list_id: yourlistid
stripe_api_key: yourkey
stripe_publishable_key: yourkey
If you are having trouble with Unix ENV variables you don't have to use them. Just put the values into your config/secrets.yml file. But don't check it into git, just diagnose the problem by hardcoding the values.
@rsgrafx Did you manage to fix this issue? @DanielKehoe Can we 'open' this issue?
I've reopened the issue as requested. Is there anyone who has not been able to resolve the issue by setting the Unix ENV variables or hardcoding the vales in the config/secrets.yml file?
I haven't been able, either. I changed quite a few things and made it to work. Will commit to the fork and than try to diff to find out what is it that made it work.
==EDIT: just pushed my changes to my fork - you can have a look at the differences - it should be in the config directory. I've excluded the files containing sensitive data (the *yml ones) - I can give you a censored version of them, too - if necessary.
The only purpose of the fetch
method is to force an error if the API keys are not available in the Unix ENV variables when the application is started. This lets the developer know that the API key is not available and avoids more mysterious errors later. You can remove the fetch
method from the config/secrets.yml file and the application will run without the initial error. But it will fail later if the API key is not available.
@DanielKehoe More info : I get this error while running the composer command $ rails new rails-stripe-membership-saas -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
The errors don't go away even after adding the API keys in the environment variables.
@ashwinputhige Could you clarify please, do you get the I get "KeyError: key not found" when the Rails Composer script is running (causing a failure before an app is created)? Or do you build an app using Rails Composer successfully, and then get the error when you launch the app with rails server
?
I get it when the rails composer script is running before the app is created. It happens at the command bundle exec rake db:command (I believe its db:migrate)
. I can retry if that is important.
Thank you @ashwinputhige, that is helpful.
I've released a new version of Rails Composer that removes the fetch
method from the config/secrets.yml file. @ashwinputhige please give it a try and let me know if the issue is resolved.
@ashwinputhige : This note replaced with my next comment.
@ashwinputhige @nikolay12 @rsgrafx : Please see PR Testsformaster #150 . I invite you to pull this branch into your working app, and take it for a spin. You will see it has tests that resolve Issue #143 . If you can help resolve the four pending tests, that would be grand, thank you.
@kathyonu Sorry, I am not using this application and so I will not be able to run your tests. Please feel free to close the issue if required.
I just git cloned the repository - the problem still persists. I cancelled my Railsapp subscription - sorry Daniel, it just does not make sense to continue paying for something that is so brittle.
@nikolay12 @ashwinputhige @rsgrafx @DanielKehoe Greetings .. I have changed my mind, ashwinputhige, and nikolay12 I ask you to change yours too .. If you will look at Issue #152, specifically the posts i made there yesterday ..you will find a resource that really is priceless in these matters of setting the enviroment variables. So that you know, I have an in production rails-stripe-membership-saas running sweet as can be, and I have gone through the exact same issues you are facing and I can easily help resolve them for you .. and others you may run into. Please re-signup with RailsApps if need be and accept this offer of help and you will have a high power fully-tested app at your fingertips .. the tests are arriving as referred to in Issue #152 and more to come. We are also going to be adding capabilities after what exists is fully tested.
try this :)
bin/spring stop
same problem using ubuntu 16
Getting same error. Any solution?
Here too! This was working until I updated rails to 6.1
I am not an expert in rails, but here's the stack trace.
It occurs just after "run bundle exec rake db:migrate from "."" and happens for all future "rake" commands.