I am using the cloudinary with my application to upload images but I seem to get this error on development. I have the site launched and it gives this error when I try to upload an image.
Uncaught Missing required option: cloud_name
When I run it in development (localhost), it doesn't throw this error and works perfectly. Is this an issue in my production.rb or development.rb files? Did I forget to include something?
It's actually because I never pushed my keys to heroku with figaro. I'm using a Backbone.js frontend and a rails backend and I ignore my cloudname and API keys in gitignore so it was never on heroku.
I had to run:
figaro heroku:set -e production
and then it all worked :)
Related
I've build a simple website, using Rails so I can deploy it to Heroku. It runs perfectly locally, everything works fine. It deploys fine to Heroku but when opening the webpage (http://a-clean.herokuapp.com/) I get the following error displayed:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
When I check the logs (running heroku logs in terminal) it shows the error:
ActionView::Template::Error (The asset "a_clean_sample_1.jpg" is not present in the asset pipeline.)
So far this is just a one-page website with a couple of partials. Here is the github repository: https://github.com/webbc99/a-clean
The image it's failing on is loaded in app/views/welcome/home.html.erb line 57.
Rails version 5.1.6, Ruby version 2.5.0
I've double checked that the images are in fact in the app/assets/images folder, and the image_tags are using the file extensions.
I've tried running heroku run rake assets:precompile, and I've tried using the rails12factor gem and also without it. I have tried changing config.assets.compile = false to true in the config/environments/production.rb which did get the page to load but all of the images were ignoring styling and were huge.
What is really confusing me is that I have deployed several other rails apps, same rails version, same ruby version, and none of these have had this issue before.
Here is a working app:
https://github.com/webbc99/presumptuous
https://presumptuous.herokuapp.com/
Any help would be greatly appreciated, been googling this for hours with no luck.
It's the simplest way to fix this problem is; You need to run as follows;
rails assets:precompile RAILS_ENV=production
git add .
git commit -m {message}
git push heroku master (push the code to the heroku again)
I tried to do it from your code and work fine.
I'm using Rails 3.0.10 and running rake assets precompile at production server and facing problem as manifest requires output filename.this code is already deployed on heroku server and working fine. Please provide a solution on this.
I am new to rails from java enviroment. I have few confusions in asset pipeline with rails 3 to 4.
Currently I am in rails 4.2.5
I created a sample app on my local environment.
I created a new js from inside app/assets/javascripts and referencing it from the view , everything seems to working fine on my local environment.
After this I thought to test with production env how it works. Here are the steps I did.
RAILS_ENV=production rake assets:clean assets:precompile [All the files created public/assets]
Started the server in production mode rails server -e production
Now when i browsed the page I am getting this error,
"NetworkError: 404 Not Found - http://localhost:3000/assets/application-c5c431cb7c0a202f831a634922aaf1d536712002ae74334fb03ba4698b32b84c.js" in firebug.
When searched few threads , they suggest to add config.assets.compile = true. But I do not think so this is what the solution is, as it slows down the app.
Please help.
By default Rails4 will return a 404 if an asset is not handled via an
external proxy such as Nginx.
- https://github.com/heroku/rails_serve_static_assets
I suggest you have a look at the rails_12factor gem, which includes the rails_serve_static_assets gem which will allow your Rails app to serve static assets (like your .js file).
Edit:
You may not need a gem for this (though I've not tried it):
config.serve_static_files configures Rails itself to serve static
files. Defaults to true, but in the production environment is turned
off as the server software (e.g. NGINX or Apache) used to run the
application should serve static assets instead. Unlike the default
setting set this to true when running (absolutely not recommended!) or
testing your app in production mode using WEBrick. Otherwise you won't
be able use page caching and requests for files that exist regularly
under the public directory will anyway hit your Rails app.
- http://guides.rubyonrails.org/configuring.html
In Rails 5, this config method has been renamed to config.public_file_server.enabled, the rails_serve_static_assets gem handles the correct naming depending on version.
I updated a gem(rtf) in my ruby on rails app through the Gemfile. The app works fine on my localhost but when I pushed changes to heroku and tried 'bundle install' within heroku bash. I see that the gem has been installed based on the log
Using rtf (0.3.3)
Following this, I did a
heroku restart --a myapp
however, when i tried the app on heroku, it still cant recognize the lib installed through the gem, i get the following error(normally appears when the library cannot be reached for command "require 'RTF'").
cannot load such file -- RTF
What am I doing wrong in heroku?
I think you misunderstand how Heroku works. When you run a bash shell on your app, nothing you do on that dyno will affect any other dynos for your app (like your web dynos). Heroku runs bundle install for you when you deploy your app and if your Gemfile is configured correctly all the gems will be installed.
the answer by sevenseacat is right- i had just got the case wrong-
require 'rtf'
works fine. In OSX, it ignores case in the command require 'RTF'
I have asked this question in the locomotivecms google groups, but haven't gotten any useful response yet. So, trying out here. I have a feeling the issue is not just a rails issue but has something to do with how the locomotivecms engine is implemented.
I installed the locomotivecms app as per the instructions here - http://doc.locomotivecms.com/guides/get-started/install-engine
The app runs fine in development mode.
I then precompiled the assets and started it in production mode (bundle exec unicorn_rails -E production). Now when I open the app in the browser, the stylesheets are not rendered. I have checked the public/assets and the fingerprinted stylesheet requested by the browser is present there. Yet it is not rendered correctly. This is what the chrome view resources shows:
It looks as if the stylesheet contains html. If I open it from the public/assets folder it contains css. I think Locomotive is intercepting the request and somehow not returning the css. Locomotive is open source, their code is on github - https://github.com/locomotivecms/engine.
The problem was not with Locomotivecms, it was a rails thing that I did not know about. I had following in production.rb:
config.serve_static_assets = false
This setting is right if you are running your app in Nginx or Apache in production. In which case they server the public assets. But if you are running your app on simply a rails server in production, like unicorn, webbrick, thin etc. then you need to set this setting to true in order for the rails server to serve assets from public folder. I set this to true, started the server (bundle exec unicorn_rails -E production) the assets were served fine.
More explanation on config.serve_static_assets can be found here: http://guides.rubyonrails.org/configuring.html