Recaptcha verification failture

I am using the rails ambethia-recaptcha gem

My recaptcha verification fails in production, the same code works
just fine in development. I made sure the public and private keys are
correct and the correct keys load in the production enviornment. My
production server hostname is “server” (this is kinda test production
basically a server in my home network running passenger on xubuntu)
and I generated the keys are recaptcha with that name. Where do I even
begin to troubleshoot this?

In config.yml

test:
recap_pub_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H
recap_priv_key: 6LcbaboSAAAAACJMtxxfExG5dm_GcDHuZl9WVjZG
google_js_api: ABQIAAAAi_F8JNAI9__oCG-
KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q
development:
recap_pub_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H
recap_priv_key: 6LcbaboSAAAAACJMtxxfExG5dm_GcDHuZl9WVjZG
google_js_api: ABQIAAAAi_F8JNAI9__oCG-
KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q
production:
recap_pub_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H
recap_priv_key: 6LcbaboSAAAAACJMtxxfExG5dm_GcDHuZl9WVjZG
google_js_api: ABQIAAAAi_F8JNAI9__oCG-
KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q

in environment.rb

APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/config.yml")
[RAILS_ENV]
ENV[‘RECAPTCHA_PUBLIC_KEY’] = APP_CONFIG[‘recap_pub_key’]
ENV[‘RECAPTCHA_PRIVATE_KEY’] = APP_CONFIG[‘recap_priv_key’]
ENV[‘GOOGLE_JS_API’] = APP_CONFIG[‘google_js_api’]

In users_controller.rb

def create
@user = User.new(params[:user])
@user.role = Role.find_by_name(‘user’)
v = verify_recaptcha(:model => @user, :message => “Text
entered did not match the image!”)
logger.debug v.to_s
logger.debug @user.inspect
logger.debug “Errors for this registration”
logger.debug @user.errors.inspect
if v
if @user.save_without_session_maintenance
@user.send_later :deliver_activation_instructions!
flash[:notice] = t(‘users.create.confirmation’)

redirect_back_or_default root_url

            redirect_to root_url
        else
            render :action => :new
        end
    else

@user.errors.add()

flash[:error] = “Text entered did not match the image”

        render :action => :new
    end
end

in production.log

Recaptcha result - false
#<User id: nil, email: “[email protected]”, zip: “88888”,
processing_vote: false, cached_slug: nil, username: “user1”, sex: 0,
age: 29, lat: nil,
lng: nil, role_id: 2, posts_count: 0, active: nil, created_at: nil,
updated_at: nil, crypted_password:
“2754e9333463856a1aaa4a91e5616323866e8833fafc
54e3029…”, password_salt: “pdQQJpXxzqHJyNXjYO_M”, persistence_token:
“7bd973e319a175a7048680850a552667f668ee859b9af137a16…”,
single_access_token:
“muJOtrpdTXPJ6cQWtZs3”, perishable_token: nil, login_count: 0,
failed_login_count: 0, last_request_at: nil, current_login_at: nil,
last_login_at: ni
l, current_login_ip: nil, last_login_ip: nil, image_file_name: nil,
image_content_type: nil, image_file_size: nil, image_updated_at: nil,
processing:
true>
Errors for this registration
#<ActiveRecord::Errors:0xb2d1044 @base=#<User id: nil, email:
[email protected]”, zip: “94131”, processing_post: false, cached_slug:
nil, userna
me: “user1”, sex: 0, age: 29, lat: nil, lng: nil, role_id: 2,
posts_count: 0, active: nil, created_at: nil, updated_at: nil,
crypted_password: “2754e
9333463856a1aaa4a91e5616323866e8833fafc54e3029…”, password_salt:
“pdQQJpXxzqHJyNXjYO_M”, persistence_token:
“7bd973e319a175a7048680850a552667f668ee
859b9af137a16…”, single_access_token: “muJOtrpdTXPJ6cQWtZs3”,
perishable_token: nil, login_count: 0, failed_login_count: 0,
last_request_at: nil, c
urrent_login_at: nil, last_login_at: nil, current_login_ip: nil,
last_login_ip: nil, image_file_name: nil, image_content_type: nil,
image_file_size:
nil, image_updated_at: nil, processing: true>, @errors=#<OrderedHash
{“base”=>[#<ActiveRecord::Error:0xb0b7c54 @base=#<User id: nil, email:
[email protected]”, zip: “88888”, processing_vote: false, cached_slug:
nil, username: “user1”, sex: 0, age: 29, lat: nil, lng: nil, role_id:
2, posts_cou
nt: 0, active: nil, created_at: nil, updated_at: nil,
crypted_password:
“2754e9333463856a1aaa4a91e5616323866e8833fafc54e3029…”,
password_salt: “pdQ
QJpXxzqHJyNXjYO_M”, persistence_token:
“7bd973e319a175a7048680850a552667f668ee859b9af137a16…”,
single_access_token: “muJOtrpdTXPJ6cQWtZs3”, perisha
ble_token: nil, login_count: 0, failed_login_count: 0,
last_request_at: nil, current_login_at: nil, last_login_at: nil,
current_login_ip: nil, last_l
ogin_ip: nil, image_file_name: nil, image_content_type: nil,
image_file_size: nil, image_updated_at: nil, processing: true>,
@attribute=:base, @messa
ge=“Text entered did not match the image!”, @type=“Text entered did
not match the image!”, @options={}>]}>>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs