Ruby Sinatra应用程序在Heroku上无误崩溃,但通过foreman-tips在本地运行良好?
我有一个简单的Sinatra应用程序,与Foreman一起在本地运行良好。但在Heroku上,它立即崩溃:Ruby Sinatra应用程序在Heroku上无误崩溃,但通过foreman-tips在本地运行良好?,ruby,heroku,oauth,sinatra,Ruby,Heroku,Oauth,Sinatra,我有一个简单的Sinatra应用程序,与Foreman一起在本地运行良好。但在Heroku上,它立即崩溃: 2013-09-17T18:52:37.449716+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=rfcstd.herokuapp.com fwd="38.122.223.90" dyno= connect= service= status=503 bytes= 2013
2013-09-17T18:52:37.449716+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=rfcstd.herokuapp.com fwd="38.122.223.90" dyno= connect= service= status=503 bytes=
2013-09-17T18:55:29.671059+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=rfcstd.herokuapp.com fwd="38.122.223.90" dyno= connect= service= status=503 bytes=
没有关于该错误的进一步信息
我的应用程序基于。我一直在尝试对Procfile和config.ru进行多次迭代,以使其正常工作,例如
Procfile.rb >
web: bundle exec ruby signing.rb -p $PORT
Answer:
Starting process with command `bundle exec rackup config.ru -p 14469`
configuration /app/config.ru not found
应用程序中没有包含config.ru,因此我尝试自己创建:
Procfile.rb >
web: bundle exec rackup ./config.ru -p $PORT
OR
web: bundle exec rackup config.ru -p $PORT
Config.ru >
require './signin.rb'
run Sinatra::Application
Answer:
at=error code=H10 desc="App crashed" method=GET path=/ host=rfcstd.herokuapp.com fwd="38.122.223.90" dyno= connect= service= status=503 bytes=
Google coded signin.rb启动了Sinatra,我认为这不是作为rack应用程序启动它的标准方式。Heroku似乎检测到了rack应用程序,但随后由于某些文件不可用而窒息。。。以下是signin.rb的一个片段:
##
# The Google+ Ruby Quickstart lets you get started with the Google+ platform
# in a few minutes.
#
# The app demonstrates:
# * Using the Google+ Sign-In button to get an OAuth 2.0 refresh token.
# * Exchanging the refresh token for an access token.
# * Making Google+ API requests with the access token, including getting a
# list of people that the user has circled.
# * Disconnecting the app from the user's Google account and revoking tokens.
#
# Author: class@google.com (Gus Class)
require 'bundler/setup'
require 'base64'
require 'rubygems'
require 'json'
require 'sinatra'
require 'google/api_client'
require 'google/api_client/client_secrets'
require 'net/https'
require 'uri'
require 'open-uri'
use Rack::Session::Pool, :expire_after => 86400 # 1 day
# Configuration
# See the README.md for getting the OAuth 2.0 client ID and
# client secret.
# Configuration that you probably don't have to change
APPLICATION_NAME = 'MyAppName'
PLUS_LOGIN_SCOPE = 'https://www.googleapis.com/auth/plus.login'
#set :port, 5000
# Build the global client
$credentials = Google::APIClient::ClientSecrets.load
$authorization = Signet::OAuth2::Client.new(
:authorization_uri => $credentials.authorization_uri,
:token_credential_uri => $credentials.token_credential_uri,
:client_id => $credentials.client_id,
:client_secret => $credentials.client_secret,
:redirect_uri => $credentials.redirect_uris.first,
:scope => PLUS_LOGIN_SCOPE)
$client = Google::APIClient.new(:application_name => APPLICATION_NAME, :application_version => '0.1')
也许你没有安装所有的gems?@akonsu我在本地用bundle exec进行了测试,我在gems文件中有我需要的所有gems。此外,我认为Heroku会抱怨找不到宝石。奇怪的是没有错误通知。耶,我在评论中找到了答案:我在本地的另一个分支工作,它没有将其更改推送到Heroku。Heroku只推动主分支。哎哟正在工作:)