Completed 500 Internal Server Error in 112ms (MongoDB: 0.0ms) using rails version '5.2.4' error in ssl - ruby-on-rails

Completed 500 Internal Server Error in 112ms (MongoDB: 0.0ms
Errno::ECONNRESET: Connection reset by peer - SSL_connect

Related

Action cable direct connection (Expected HTTP 101 response but was '404 Not Found' + Failed to upgrade to WebSocket)

I'm trying to open a direct websocket connection to the route of my action cable. Unfortunately that's not working. I'm only getting this error when curling or just hitting http://localhost:3000/cable directly..
Started GET "/cable" for 127.0.0.1 at 2019-02-06 20:04:08 -0600
Started GET "/cable/"[non-WebSocket] for 127.0.0.1 at 2019-02-06 20:04:08 -0600
Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: keep-alive, HTTP_UPGRADE: )
Finished "/cable/"[non-WebSocket] for 127.0.0.1 at 2019-02-06 20:04:08 -0600
This is the exception in my client:
java.net.ProtocolException: Expected HTTP 101 response but was ‘404 Not Found’
But if I hit http://localhost:3000/page/index with a browser, I see the following output:
Started GET "/page/index" for 127.0.0.1 at 2019-02-06 20:05:30 -0600
Processing by PageController#index as HTML
Rendering page/index.html.erb within layouts/application
Rendered page/index.html.erb within layouts/application (0.3ms)
Completed 200 OK in 28ms (Views: 25.5ms | ActiveRecord: 0.0ms)
Started GET "/cable" for 127.0.0.1 at 2019-02-06 20:05:30 -0600
Started GET "/cable/" [WebSocket] for 127.0.0.1 at 2019-02-06 20:05:30 -0600
Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
User Load (0.7ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT $1 [["LIMIT", 1]]
↳ app/channels/application_cable/connection.rb:12
Registered connection (Z2lkOi8vd2hvcy1yZWFkeS1hcGkvVXNlci8z)
RoomChannel is transmitting the subscription confirmation
RoomChannel is streaming from room_channel
RoomChannel is transmitting the subscription confirmation
RoomChannel is streaming from room_channel
Here are the relevant files, let me know if I need to share more:
#routes.rb
Rails.application.routes.draw do
mount API::Base, at: '/'
mount ActionCable.server => '/cable/chat'
get 'page/index'
root 'page#index'
end
#page_controller.rb
class PageController < ApplicationController
def index
end
end
I'm trying to get a connection to the websocket simply by curling to the ActionCable server route. Is that possible?
The issue was that I was not sending an Origin header on the http request so allowed_request_origins couldnt match anything. Because of that, it was giving this super obscure error message about not being able to convert the http connection to a websocket one.

500 Error: TypeError (no implicit conversion of nil into String):

I have enabled my GitLab server to use the GitLab registry which is hosted on another server. It was installed from source.
The GitLab admin console indicates that the registry is enabled and active, however when I try to access the registry a 500 error is thrown.
The production logs show the following
Started GET "/root/Test/container_registry" for 10.188.144.64 at 2016-12-01 11:42:00 +0000
Processing by Projects::ContainerRegistryController#index as HTML
Parameters: {"namespace_id"=>"root", "project_id"=>"Test"}
Completed 500 Internal Server Error in 61ms (ActiveRecord: 4.0ms)
TypeError (no implicit conversion of nil into String):
lib/json_web_token/rsa_token.rb:20:in `read'
lib/json_web_token/rsa_token.rb:20:in `key_data'
lib/json_web_token/rsa_token.rb:24:in `key'
lib/json_web_token/rsa_token.rb:28:in `public_key'
lib/json_web_token/rsa_token.rb:33:in `kid'
lib/json_web_token/rsa_token.rb:12:in `encoded'
app/services/auth/container_registry_authentication_service.rb:30:in `full_access_token'
app/models/project.rb:463:in `container_registry_repository'
app/controllers/projects/container_registry_controller.rb:28:in `container_registry_repository'
app/controllers/projects/container_registry_controller.rb:8:in `index'
lib/gitlab/request_profiler/middleware.rb:15:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
Any advice or guidance with fixing this would be welcome!
Thanks in advance.

Rails 4.2.6 disable MD5 for FIPS compliance

How does one disable MD5 and other non-FIPS compliant algorithms in Rails 4.2.6 and Ruby 2.2+?
Started GET "/" for ::1 at 2016-04-12 11:00:52 -0400 Processing by
Rails::WelcomeController#index as ​/​ Rendered
/usr/local/rvm/gems/ruby-2.2.4/gems/railties-4.2.6/lib/rails/templates/rails/welcome/index.html.erb
(0.9ms) Completed 200 OK in 20ms (Views: 6.5ms | ActiveRecord: 0.0ms)
md5_dgst.c(78): OpenSSL internal error, assertion failed: Digest MD5
forbidden in FIPS mode! Aborted (core dumped)
This has been addressed in Rails 5.2. See https://github.com/rails/rails/issues/31203. New apps should be compliant now by default and upgraded ones can use Rails.application.config.active_support.use_sha1_digests = true

Error CordovaModuleLoadError - multi device hybrid app in visual studio

I am following the steps here and here to build and simulate a multi device hybrid app in ios.
I followed the steps in the articles and I can see that when I run my multi device hybrid app in visual studio using iphone simulator as the run target, the connected mac device response to the build request. However, the mac terminal will end the build process with the following build error:
Done building 5116: error CordovaModuleLoadError [ '3.5.0-0.2.4' ]
And here is the full terminal output:
IBRAHIM-ALHUSSAINs-Mac-mini:cordova IBRAHIMALHUSSAIN$ vs-mda-remote --secure false
vs-mda-remote
Copyright (C) 2014 Microsoft Corporation. All rights reserved.
0.2.11
Loading resources for language en from /usr/local/lib/node_modules/vs-mda-remote/resources/en/resources.json
Build Retention initialized with baseBuildDir /Users/IBRAHIMALHUSSAIN/remote-builds/builds, maxBuildsToKeep 20
Initialized BuildManager with baseBuildDir /Users/IBRAHIMALHUSSAIN/remote-builds/builds; maxBuildsInQueue 10; deleteBuildsOnShutdown true; allowsEmulate true; nextBuildNumber 5115
Remote build server listening on [http] port 3000
ios-sim is installed on path at: /usr/local/lib/node_modules/vs-mda-remote/node_modules/ios-sim/build/release/ios-sim
New build request submitted:
/build/tasks?command=build&vcordova=3.5.0-0.2.4&cfg=release
{ 'accept-language': 'en-US',
host: '192.168.1.11:3000',
connection: 'keep-alive',
'transfer-encoding': 'chunked' }
New build request submitted for cordovaVersion: 3.5.0-0.2.4; buildCommand: build; configuration: release
Build will be executed under: /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116
Saving build request payload to : /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116
Saved upload to /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116/upload_5116.tgz
Extracting /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116/upload_5116.tgz to /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116/cordovaApp...
POST /build/tasks?command=build&vcordova=3.5.0-0.2.4&cfg=release 202 1279ms - 529b
GET /build/tasks/5116 200 3ms - 529b
Extracted app contents from uploaded build request to /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116/cordovaApp. Requesting build.
Taking 5116 as current build
Building cordova app B8ak بيتك at appDir /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116/cordovaApp
Opened build log file /Users/IBRAHIMALHUSSAIN/remote-builds/builds/5116/build.log
GET /build/tasks/5116 200 2ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 2ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 2ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 0ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
GET /build/tasks/5116 200 1ms - 625b
Done building 5116 : error CordovaModuleLoadError [ '3.5.0-0.2.4' ]
Done with currentBuild. Checking for next build in queue.
GET /build/tasks/5116 200 2ms - 667b
GET /build/tasks/5116/log 200 4ms
This indicates you are using CTP2 of tools for Apache Cordova. Moving to CTP3.1 or VS 2015 RC should resolve your issue.
VS 2015 will also allow you to select the version of Cordova you use though you could see problems with a year old release like Cordova 3.5.0. The default in VS 2015 of 4.3.0 should be compatible and contains numerous bug fixes including security improvements.
VS 2015 will be the supported version of Tools for Apache Cordova. Previous releases were only technology previews.

Can access production database from Rails console but not Rails App

When I try to login to my Devise app using the rails console on my production database, I can with no trouble, however I cannot when using my Rails App.
I launch my Rails Console with rails c -e production, from my home environment (not SSHing int it or anything) and then proceed to execute app.post('/users/sign_in', {"user"=>{"email"=>"email", "password"=>"password"}}), which succeeds with:
Started POST "/users/sign_in" for 127.0.0.1 at 2014-03-10 05:37:31 +0000
Started POST "/users/sign_in" for 127.0.0.1 at 2014-03-10 05:37:31 +0000
Processing by DeviseSessionsController#create as HTML
Processing by DeviseSessionsController#create as HTML
Parameters: {"user"=>{"email"=>"amar#sittr.co.nz", "password"=>"[FILTERED]"}}
Parameters: {"user"=>{"email"=>"amar#sittr.co.nz", "password"=>"[FILTERED]"}}
Redirected to http://www.example.com/dashboard
Redirected to http://www.example.com/dashboard
Completed 302 Found in 1830ms (ActiveRecord: 1426.3ms)
Completed 302 Found in 1830ms (ActiveRecord: 1426.3ms)
=> 302
From which I can then use app.get '/dashboard' which is a password protected page, and then succeeds with:
Started GET "/dashboard" for 127.0.0.1 at 2014-03-10 05:38:14 +0000
Started GET "/dashboard" for 127.0.0.1 at 2014-03-10 05:38:14 +0000
Processing by StaticPagesController#home as HTML
Processing by StaticPagesController#home as HTML
Rendered static_pages/home.html.haml within layouts/application (139.6ms)
Rendered static_pages/home.html.haml within layouts/application (139.6ms)
Completed 200 OK in 6370ms (Views: 686.2ms | ActiveRecord: 5087.6ms)
Completed 200 OK in 6370ms (Views: 686.2ms | ActiveRecord: 5087.6ms)
=> 200
This is all working as expected, except for when I try and go to the production site, and sign in with the same credentials, it gives me a 500 error Errno::ECONNREFUSEDdevise_sessions#create
Connection refused - connect(2) for "localhost" port 9200. What confuses me is that this says it is trying to connect to localhost which wouldn't make any sense. The following is my database.yml file (with the sensitive bits taken out):
production:
adapter: postgresql
database: db_name
pool: 5
timeout: 5000
host: rds.database.com
port: 5432
username: username
password: password
As you can see, I have set the port and host correctly. What am I doing wrong? Thanks in advance.

Resources