Images not showing in my development environment with ActiveStorage - ruby-on-rails-5

I am getting in my logs:
Processing by ActiveStorage::RepresentationsController#show as HTML
Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbllYIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--882d67a6af266354eb355e33060e83b14392b7dd", "variation_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VWTI5dFltbHVaVjl2Y0hScGIyNXpld2c2QzNKbGMybDZaVWtpRFRZd01IZzBNREJlQmpvR1JWUTZDMlY0ZEdWdWRFa2lERFl3TUhnME1EQUdPd2RVT2d4bmNtRjJhWFI1U1NJTFkyVnVkR1Z5QmpzSFZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--3d3c1b8fcf97978bbeefe89263187c2b76921aff", "filename"=>"product_image"}
Filter chain halted as :set_blob rendered or redirected
Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
I have the correct keys in my storage.yml file, and I am using the same database as in my production build (where the images are working fine). In the front the urls are showing like:
src="/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbllYIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--882d67a6af266354eb355e33060e83b14392b7dd/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VWTI5dFltbHVaVjl2Y0hScGIyNXpld2c2QzNKbGMybDZaVWtpRFRZd01IZzBNREJlQmpvR1JWUTZDMlY0ZEdWdWRFa2lERFl3TUhnME1EQUdPd2RVT2d4bmNtRjJhWFI1U1NJTFkyVnVkR1Z5QmpzSFZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--3d3c1b8fcf97978bbeefe89263187c2b76921aff/product_image"
I am using rails 5.2.4.4
I can see this is the line giving problems:
https://github.com/rails/rails/blob/main/activestorage/app/controllers/concerns/active_storage/set_blob.rb#L12
I have tried it in my local console and it gives back:
#blob = ActiveStorage::Blob.find_signed(params[:signed_blob_id] || params[:signed_id])
ActiveSupport::MessageVerifier::InvalidSignature (ActiveSupport::MessageVerifier::InvalidSignature)
Images generated with:
Rails.application.routes.url_helpers.rails_representation_url(image.variant(resize: "600x400^", extent: "600x400"), only_path: true)

Related

apache gives 404 and failed on same resource

My server keeps crashing when i try to load a page with 404 images.
Theres about 10 misisng images, which should indeed just result in 404.
Sometimes the images however, return a failed status.
The same image will return 404 and after refresh return failed.
(failed)net::ERR_HTTP2_PROTOCOL_ERROR
It seems that this is crashing my server. Whas going on?

Crawler for indexed_search ends with error page

I use TYPO3 8.7.16 and the newest versions of indexed_search and crawler from repository. I followed this manual
In my root template I added:
config {
absRefPrefix = /
index_enable = 1
index_externals = 1
}
In my crawler configuration I choose
(Protocol for crawling) keep page configured protocol
(Processing instruction filter) Re-indexing [tx_indexedsearch_reindex]
(Page Id of TypoScript root template) The folder with the root template
(Append cHash) chosen
I go to Web > Info
I switch to “Site Crawler” in the top dropdown menu
choose action “Site Crawling”
select my crawler configuration, update and crawl the sole URL that has been found
switch to the crawler log to show the pending queue; the URL of the page looks fine ( https://example.org/index.php?id=25&cHash= )
then I process manually the arrows before the date and get the following error message:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1509296606 Failed to fetch error page "https://example.org/typo3/404.html", reason: Client error: GET https://example.org/typo3/404.html resulted in a 404 Not Found response: https://www.example.org/typo3/index.php?M=web_info&moduleToken=--AnonymizedToken--&qid_read=335&setID=0&id=25
What do I miss?
BTW my error page is https://example.org/404.html and works fine.

Stylesheet doesn't work in firefox and IE

I'm loosing it right now because I have no idea why my stylesheet won't load in another browser than chrome !
This is the link to my page that need styling : http://peda.au-fil-du-temps.com/toutes-nos-offres/
Maybe I haven't seen something obvious, but I've tried and tried and tried... I don't get it.
Can one of you guys help me out with this ?
Cheers
Your sources are not linked correctly.
Failed to load resource: the server responded with a status of 404 (Not Found) http://peda.au-fil-du-temps.com/js/fitrify.min.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://peda.au-fil-du-temps.com/js/fitrify.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://peda.au-fil-du-temps.com/wp-content/themes/divi_theme_enfant/libel-webfont.ttf
Failed to load resource: the server responded with a status of 404 (Not Found) http://peda.au-fil-du-temps.com/wp-content/themes/divi_theme_enfant/libel-webfont.svg#libel_suitregular
Resource interpreted as Font but transferred with MIME type text/html:
etc....
hit F12 to open the dev console and investigate your url paths.

gitlab :import existing repository .not working correctly

Here is the details of my setup:
Gitlab version: 5.2
Operating System: Centos 6.3
I am Importing an existing repository while creating a new project(/projects/new) .
A new EMPTY project is created however no repository is imported and no error message comes up. While I was digging around I found this in my puma.stderr.log.
=== puma startup: 2013-06-13 15:37:53 +0530 ===
error: Couldn't resolve host 'github.com' while accessing https://github.com/<username>/tester.git/info/refs
This GitLab installation is behind a HTTP proxy server and it seems like the proxy settings aren’t configured. But, my /etc/profile.d/ has a script that sets the proxy system wide with variables http_proxy and https_proxy.
On further investigation I checked whether the problem could be with gitlab-shell unable to reach out to the URL via the proxy and I tried the following.
$./bin/gitlab-projects import-project xxx/tester_test_test.git https://github.com/<username>/tester.git
This seems to work perfectly.
It seems like Puma does not use this gitlab-shell and is trying to reach out to the URL. Which leads me to the question, how do I tell PUMA about my proxy server?
Following is my production.log
Started GET "/favicon.ico" for 170.95.35.204 at 2013-06-13 16:20:00 +0530
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"favicon.ico"}
Rendered public/404.html (0.0ms)
Filter chain halted as :project rendered or redirected
Completed 404 Not Found in 5ms (Views: 0.7ms | ActiveRecord: 0.7ms)
Started GET "/projects/new" for 170.95.35.204 at 2013-06-13 16:20:04 +0530
Processing by ProjectsController#new as HTML
Rendered projects/_errors.html.haml (0.1ms)
Rendered projects/new.html.haml within layouts/application (4.1ms)
Rendered layouts/_head.html.haml (0.7ms)
Rendered layouts/_search.html.haml (57.5ms)
Rendered layouts/_head_panel.html.haml (60.4ms)
Rendered layouts/_flash.html.haml (0.1ms)
Rendered layouts/nav/_dashboard.html.haml (3.0ms)
Completed 200 OK in 72ms (Views: 65.8ms | ActiveRecord: 4.0ms)``
When encountering gitlab import problems, this is a general workaround.
Create a bare project in gitlab
Add it as a remote in an existing cloned [and up to date] repo. You can git fetch from your current origin to bring it up to date.
git remote add mygitlab [bare project URL from #1]
Push the existing repo state to the new remote
git push mygitlab --all
You may want to check some of the various recipes here if you have a problem getting everything to push: Push local Git repo to new remote including all branches and tags
I myself just edit .git/config by hand. Take the mygitlab URL and make it the origin url. You can just delete the mygitlab block, or via command line:
git remote remove mygitlab
This is easier than banging rocks together trying to get gitlab to import something it doesn't want to [for me, it's bitbucket right now].

ApacheBenchmark ab issue with Rails3 authenticity_token

I was trying to play around with AB for performance recording/tracking in a new Rails 3 app.
Since the app always require to be logged in, I had to do POST request to login.
I was able to put the credentials in some text file as follows but the AuthenticityToken is giving the problem.
#login_data.txt
user_account%5Busername%5D=admin&user_account%5Bpassword%5D=adminhr
#AB command
ab -v4 -n100 -t5 -T 'application/x-www-form-urlencoded' -p login_data.txt http://nhc.lvh.me:3000/
#The log
Started POST "/" for 127.0.0.1 at 2011-02-15 11:13:37 +0545
Processing by CompaniesController#index as */*
Parameters: {"user_account"=>{"username"=>"admin", "password"=>"[FILTERED]"}}
Completed in 1ms
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
Rendered /Users/millisami/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered /Users/millisami/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1194.0ms)
Rendered /Users/millisami/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (1291.3ms)
The problem is how to pass or ignore that AuthenticityToken when using ab?
Since it gets generated dynamically, can I store somewhere or is there other better solution?
What you could do is set up an environment aside from test and development. You could put a copy of development.rb environment and name it benchmark.rb.
Also put an entry on database.yml for the benchmark environment. You could copy the contents of the development entry for this.
And then in your code you could skip validation of authenticity token if the environment is benchmark. Now fire up rails s -e benchmark and perform your benchmark against that server.