2016-09-28 100 views
1

我已成功安裝超級掛鉤。 我不得不將它安裝在Mac El Capitan的usr/local/bin中,因爲我無法(由於新的安全策略)將它安裝到usr/bin中。Mac上的Codeigniter中的Ultrahook和MAMP PRO 4.0.5 El Capitan

當我運行命令:

ultrahook <my.namespace> https://localhost:8890 

我得到這個消息:

Authenticated as <namespace_name> 
Forwarding activated... 
http://<namespace_name>.ultrahook.com ->https://localhost:8890 

如此看來,一切都正常運行。

但是,當我從條紋發送測試通知經由這個網絡掛接以下錯誤上述將在終端顯示:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:878:in `open' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:878:in `block in connect' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/timeout.rb:52:in `timeout' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:877:in `connect' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:862:in `do_start' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:851:in `start' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1373:in `request' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1396:in `send_entity' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1184:in `post' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:127:in `http_post' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:116:in `process_request' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:90:in `process' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:160:in `block (3 levels) in init_stream' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:411:in `call_block' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:402:in `<<' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/protocol.rb:106:in `read' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:313:in `read_chunked' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:276:in `block in read_body_0' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:269:in `inflater' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:274:in `read_body_0' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:201:in `read_body' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:155:in `block (2 levels) in init_stream' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1419:in `block (2 levels) in transport_request' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:162:in `reading_body' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1418:in `block in transport_request' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1409:in `catch' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1409:in `transport_request' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:1382:in `request' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:153:in `block in init_stream' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:in `start' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:582:in `start' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:148:in `init_stream' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/lib/ultrahook/client.rb:65:in `start' 
    from /Library/Ruby/Gems/2.0.0/gems/ultrahook-0.1.4/bin/ultrahook:6:in `<top (required)>' 
    from /usr/local/bin/ultrahook:22:in `load' 
    from /usr/local/bin/ultrahook:22:in `<main>' 

我以前從未使用紅寶石或紅寶石寶石,所以無法找出這一切意味着什麼以及如何解決這個問題。

任何幫助將非常感激

感謝

這其間,我已經嘗試了很多組合,但終端的登記註冊後,這個錯誤仍然存​​在:

ultrahook stripe http://site-gen:8888/stripe19440207 
Authenticated as bootsweaver 
Forwarding activated... 
http://stripe.bootsweaver.ultrahook.com -> http://site-gen:8888/stripe19440207 

獲取迴應它仍然是一樣的:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) 

請幫我解決這個問題,我已經從昨天開始忙着這件事了,我一點也不知道這一切。

我不能繼續我的工作,我卡住了。

謝謝各位

回答

1

好的!花了兩天的時間才弄清楚出了什麼問題,現在一切正常。

所以,作爲一個專門的SO用戶,我覺得我必須分享我發現的東西。

首先想到一提的是,Ruby有一個非常普遍的方式 報告產生了錯誤,如果你不知道什麼(像我一樣) 關於Ruby那麼你有問題。

甚至認爲我看了一下抱怨方法initialize的紅寶石代碼,我發現注意到這是錯誤的。

我在Mac El Capitan上使用MAMP PRO 4.0.5作爲我的本地服務器,Codeigniter 3作爲框架,我想在超時使用ultrahook之前在本地測試Stripe webhook事件。

首先要注意的是MAMP配置。 如果你打算使用ultrahook,想安裝它照顧這個複選框選項(位於Ryby選項卡下左)處於未選中狀態:

Make ruby available in the command line 

爲什麼?

如果安裝ultrahook選中該選項時,創業板將被安裝在:

/Applications/MAMP/Library/lib/ruby/gems/2.3.0/gems 

而且你不希望出現這種情況。您通常會將其安裝在usr/bin

現在。在這個時候,由於新的安全策略El Capitan不允許你在這個文件夾中寫入。我們現在在幹什麼?

只需將其安裝在usr/local/bin中即可。

$ gem install -n /usr/local/bin ultrahook 

一旦完成,您將能夠做到在http://www.ultrahook.com/解釋的正常的東西。我很抱歉,但我想向您解釋完整的過程,但它將超出本文的範圍。

在這一點上,你將無法使用超級鉤子和由Stripe註冊你的webhook。

最後一個重要的事情是排除您正在使用的控制器(將響應條紋webhook事件的頁面) 將被csrf保護阻止。

$config['csrf_exclude_uris'] = array('stripe/webhook'); 

或者你在$ route ['']中定義的任何東西。

如果您忘記這樣做,您將得到403響應,這意味着forbidden

另一件重要的事情是,當您檢查條紋響應時,您需要在終端中通過超級名稱空間請求連接,以便查看發送給您的傳入事件。

我希望這會幫助有困難的人嘗試做這項工作。

如果您還有其他問題,我會很樂意幫助您。