Dziwny błąd w logach

hej,

Mam dziwny błąd w logach. Jest to zwykły formularz z możliwością załączenia pliku. Za pierwszym razem jak wyślemy formularz to jest błąd. jak odświeżę stronę. To zazwyczaj działa.

błąd z loga

[code]Started POST “/image/add?app_id=12” for 89.79.218.16 at 2013-05-13 17:51:57 +0200
Processing by App::ImageController#add as HTML
Parameters: {“utf8”=>“✓”, “authenticity_token”=>“163k6SiHBvkm+SzVdq8JKdabRFqAW3hZtHED2x4Riq8=”, “app_image_results”=>{“image”=>#<ActionDispatch::Http::UploadedFile:0x00000002d5e600 @original_filename=“slides.png”, @content_type=“image/png”, @headers=“Content-Disposition: form-data; name=“app_image_results[image]”; filename=“slides.png”\r\nContent-Type: image/png\r\n”, @tempfile=#<File:/tmp/RackMultipart20130513-14517-e3l6e4>>, “result”=>“test”}, “app_id”=>“12”}
Completed 500 Internal Server Error in 118ms

Faraday::Error::ConnectionFailed (getaddrinfo: Name or service not known):
app/helpers/application_helper.rb:31:in sendMessageInFB' app/controllers/app/image_controller.rb:14:inadd’[/code]
Spotkał się ktoś z tym kiedyś, z czym to może mieć związek w ogóle.?

Tu jest błąd:

[quote]Faraday::Error::ConnectionFailed (getaddrinfo: Name or service not known):
app/helpers/application_helper.rb:31:in sendMessageInFB' app/controllers/app/image_controller.rb:14:inadd’[/quote]

a nie tu

Completed 500 Internal Server Error in 118ms

a jak jest w tym miejscu co mi wskazałeś to co ten błąd oznacza.

tak wyglądają te metody

sendMessageInFB

[code=ruby] def self.sendMessageInFB(app_id,oauth_token,page_id,user_id,result=’’)
if user_id
@wall = AppWall.find_by_app_id(app_id)
if @wall.html != nil
@graph = Koala::Facebook::API.new(oauth_token)

    if result
      @post1 = @wall.html.gsub("{wynik}", result)
      @post2 = @post1.gsub("{imie}", User.find(user_id).first_name)
      @post = @post2.gsub("{nazwisko}", User.find(user_id).last_name)
    else
      @post2 = @wall.html.gsub("{imie}", User.find(user_id).first_name)
      @post = @post2.gsub("{nazwisko}", User.find(user_id).last_name)      
    end
  
    @graph.put_wall_post(@post, {
        :link => Fanpage.find_by_uid(page_id).url+'?sk=app_'+APP_ID.to_s, 
        :picture => 'http://apps.handsomemen.pl/'+@wall.images.url,
        :name => @wall.name.to_s,
        :caption => @wall.caption.to_s,
        :actions => [{:name => "Przejdź do aplikacji", :link => Fanpage.find_by_uid(page_id).url+'?sk=app_'+APP_ID.to_s}].to_json
      })  
  end
  true
else
  false
end

end[/code]
i

add

[code=ruby] def add

#send message in FB
ApplicationHelper::sendMessageInFB(params[:app_id],session['oauth_token'],session['page_id'],session['user_id_app'].to_s,'')
  
@app = AppImageResults.new
@app.user_id = session['user_id_app']
@app.app_id = params[:app_id]
@app.result = params[:app_image_results][:result]
@app.image = params[:app_image_results][:image]
@app.date = Time.now
@app.like = 0
@app.save
redirect_to image_results_path :app_id => params[:app_id]

end[/code]

http://apps.handsomemen.pl jest niedostępne przez http, przekierowuje przeglądarkę na https (gdzie z kolei marudzi o certyfikacie)

Marudzi o certyfikacie? dziwne jest wykupiony i podpięty. A jaka przeglądarka tak marudzi? Bo u mnie na safari pod mac jest ok. pisze ze certyfikat rozpoznany itp.

może to:

:picture => 'http://apps.handsomemen.pl/’+@wall.images.url,

zamienie na

:picture => 'https://apps.handsomemen.pl/’+@wall.images.url,

Jednak taka zamiana nic nie daję.

narazie wyrzuciłem config.force_ssl = false
ale nie wiem czemu rzuca się o ten certyfikat.

mały refaktoring :slight_smile:

[code=ruby]if result
@post1 = @wall.html.gsub("{wynik}", result)
@post2 = @post1.gsub("{imie}", User.find(user_id).first_name)
@post = @post2.gsub("{nazwisko}", User.find(user_id).last_name)
else
@post2 = @wall.html.gsub("{imie}", User.find(user_id).first_name)
@post = @post2.gsub("{nazwisko}", User.find(user_id).last_name)
end

#little refactoring

replacements = {}
user = User.find(user_id)
replacements[’{imie}’] = user.first_name)
replacements[’{nazwisko}’] = user.last_name
replacements[’{wynik}’] = result if result

#@post = @wall.html.gsub(/{\w+}/, replacements)
@post = @wall.html.gsub(/#{replacements.keys.join(’|’)}/, replacements) # even better ?[/code]

spoko dzięki sprawdzę to

a co oznacza taki błąd

Faraday::Error::ConnectionFailed (getaddrinfo: Name or service not known)

Dokladnie to co pisze, Nie polaczyl sie podanym adresem, adres jaki mu podales bym nieznany, mozesz sprawdzic w konsoli poprzez dig, host …

problem z DNS był.