0

여기에 어떤 문제가 있는지 알 수 없습니다. 내가 레일스/ActiveAdmin 애플 리케이션을 내가 작업을 설치했습니다. 이 작업은 레일 작업으로 래핑됩니다.Google :: Apis :: ServerError : SSL_connect SYSCALL returned = 5 errno = 0 state = SSLv2/v3 서버 읽기 안녕하세요

ruby upload.rb 그러나

으로 실행했을 때 나는 레이크 작업에이 포장하고 반환 rake google_test을 실행하면 위의 코드는 잘 간단한 테스트 파일을 업로드합니다

require 'google/apis/drive_v3' 
require 'googleauth' 
require 'googleauth/stores/file_token_store' 
require 'certified' 
require 'fileutils' 

OOB_URI = 'urn:ietf:wg:oauth:2.0:oob' 
APPLICATION_NAME = 'Google Sync' 
CLIENT_SECRETS_PATH = 'client_secret.json' 
CREDENTIALS_PATH = File.join(Dir.home, '.credentials', "app-sync.yaml") 
SCOPE = Google::Apis::DriveV3::AUTH_DRIVE_FILE 

## 
## Ensure valid credentials, either by restoring from the saved credentials 
## files or intitiating an OAuth2 authorization. If authorization is required, 
## the user's default browser will be launched to approve the request. 
## 
## @return [Google::Auth::UserRefreshCredentials] OAuth2 credentials 
def authorize 
    FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH)) 

    client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH) 
    token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH) 
    authorizer = Google::Auth::UserAuthorizer.new(
    client_id, SCOPE, token_store) 
    user_id = 'default' 
    credentials = authorizer.get_credentials(user_id) 
    if credentials.nil? 
    url = authorizer.get_authorization_url(
     base_url: OOB_URI) 
    puts "Open the following URL in the browser and enter the " + 
     "resulting code after authorization" 
    puts url 
    code = gets 
    credentials = authorizer.get_and_store_credentials_from_code(
     user_id: user_id, code: code, base_url: OOB_URI) 
    end 
    credentials 
end 

# Initialize the API 
Drive = Google::Apis::DriveV3 # Alias the module 
drive = Drive::DriveService.new 

drive.client_options.application_name = APPLICATION_NAME 
drive.authorization = authorize 

# Upload a file 
# Instead of passing a name for a file on the file system, create a pseudo file from a string 
file_contents = StringIO.new(<<FILE_CONTENTS) 
Field1,Field2,Field3 
Some,Useless,Data 
More,Useless,Info 
FILE_CONTENTS 

parent_folder_id = 'abcde...' 
new_file = Drive::File.new(name: 'Test Upload CSV', parents: [parent_folder_id]) 
new_file = drive.create_file(new_file, upload_source: file_contents, content_type: 'text/csv') 

puts "File '#{new_file.name}' created with id '#{new_file.id}'. Folder Location: https://drive.google.com/drive/folders/#{parent_folder_id}" 

upload.rb 다음과 같은 오류가 발생할 수 있습니다.

rake aborted! 
Google::Apis::ServerError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A 
C:/Users/Brian/Path/To/App/lib/tasks/member_status_tasks.rake:122:in `block (2 levels) in <top (required)>' 
Faraday::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A 
C:/Users/Path/To/App/lib/tasks/member_status_tasks.rake:122:in `block (2 levels) in <top (required)>' 
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A 
C:/Users/Path/To/App/lib/tasks/member_status_tasks.rake:122:in `block (2 levels) in <top (required)>' 
Tasks: TOP => reps_exports:member_status 
(See full trace by running task with --trace) 

해당하는 줄도입니다.

사이드 스크립트로 실행될 때 이것이 정상적으로 작동하는 이유는 누구나 알지만, 일단 레이크 작업으로 프로젝트에 추가되면 서버가 SSL 버전을 받아들이지 않는다는 사실에 실패하게됩니까? 심지어 TLSv1_2를 지정 시도하고 여전히 설치 returned=5

현재의 openssl 버전 함께 오류가 발생하지 Windows 플랫폼에서 루비 2.3.1와 레일 5.0.0.1와 1.0.1j는

+0

내가이 오류를 마지막으로봤을 때, 내 SSL 설정이 부서졌다. 나는 틀린 것을 추적하기 위해 https://github.com/mislav/ssl-tools를 사용했다. –

+0

https://github.com/mislav/ssl-tools/issues/3에 따르면 도구가 도움이되지 않습니다. – Bot

+0

ruby ​​2.3.0 및 Ubuntu 14.04에서 openssl 버전을 업그레이드해야 할 때 비슷한 오류가 발생했습니다 – BigRon

답변

-1

이 함께해야 할 수도 있습니다 사용중인 Ruby 버전.

자세한 내용은이를 참조하십시오 https://stackoverflow.com/a/33311685/777425

+0

태그마다, 나는 루비 2.3.1이고 openssl 1.0.1j이다 – Bot

+0

사과,이 태그를 게시했을 때 거기에 없었다. – samdunne