Unable to obtain peer certificate using HTTParty - ruby

I am on a MacBook (macOS 10.14.3) with OpenSSL 1.1.1b (installed via Homebrew), ruby 2.6.0 (installed via rvm), and HTTParty 0.16.4 (installed via gem/bundler). According to this example, it should be possible to download a website's peer certificate. However, when I attempt this on my machine it fails:
require "httparty"
peer_cert = nil
HTTParty.get("https://www.example.com") do |fragment|
peer_cert ||= fragment.connection.peer_cert
end
p peer_cert
With the error
Traceback (most recent call last):
28: from tmp/test.rb:5:in `<main>'
27: from /Users/nicholas.chambers/.rvm/gems/ruby-2.6.0/gems/httparty-0.16.4/lib/httparty.rb:623:in `get'
26: from /Users/nicholas.chambers/.rvm/gems/ruby-2.6.0/gems/httparty-0.16.4/lib/httparty.rb:491:in `get'
25: from /Users/nicholas.chambers/.rvm/gems/ruby-2.6.0/gems/httparty-0.16.4/lib/httparty.rb:573:in `perform_request'
24: from /Users/nicholas.chambers/.rvm/gems/ruby-2.6.0/gems/httparty-0.16.4/lib/httparty/request.rb:146:in `perform'
23: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http.rb:1470:in `request'
22: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http.rb:920:in `start'
21: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http.rb:1472:in `block in request'
20: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http.rb:1479:in `request'
19: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http.rb:1517:in `transport_request'
18: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:165:in `reading_body'
17: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http.rb:1518:in `block in transport_request'
16: from /Users/nicholas.chambers/.rvm/gems/ruby-2.6.0/gems/httparty-0.16.4/lib/httparty/request.rb:150:in `block in perform'
15: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:204:in `read_body'
14: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:283:in `read_body_0'
13: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:264:in `inflater'
12: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:293:in `block in read_body_0'
11: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:405:in `read'
10: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/protocol.rb:163:in `read'
9: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/protocol.rb:488:in `<<'
8: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/protocol.rb:497:in `call_block'
7: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:382:in `block in inflate_adapter'
6: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:382:in `inflate'
5: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/http/response.rb:384:in `block (2 levels) in inflate_adapter'
4: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/protocol.rb:488:in `<<'
3: from /Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/net/protocol.rb:497:in `call_block'
2: from /Users/nicholas.chambers/.rvm/gems/ruby-2.6.0/gems/httparty-0.16.4/lib/httparty/request.rb:152:in `block (2 levels) in perform'
1: from tmp/test.rb:6:in `block in <main>'
/Users/nicholas.chambers/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/delegate.rb:87:in `method_missing': undefined method `connection' for #<HTTParty::FragmentWithResponse:0x00007f9382035440> (NoMethodError)
I've looked through open issues in the repository, and did some googling, but nothing came up. I'm currently at a loss. Any help would be appreciated, thank you!
Update:
Although I'd like to know why HTTParty doesn't work, this workaround does it.

0.16.4 does not have a connection Source
the "example" you are referring to corresponds with additional changes
https://github.com/jnunemaker/httparty/commit/24106eef272953f3190db9115dc5ac5f6aa1600e#diff-580cbdf9b30c3492eaffdfa72a97aa58
https://github.com/jnunemaker/httparty/commit/9b5f5012ac7bb401b376c9e62179f10099f709d8
So it appears that you would need to install directly from github to have access to this feature or wait until the next version is released.

Related

In irb while defining a method named 'method', wrong number of argument apperaed

after define a method named 'method' in irb/gry
def method
puts 1
end
Traceback (most recent call last):
33: from F:/Ruby27-x64/bin/irb.cmd:31:in `<main>'
32: from F:/Ruby27-x64/bin/irb.cmd:31:in `load'
31: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
30: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:399:in `start'
29: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:470:in `run'
28: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:470:in `catch'
27: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:471:in `block in run'
26: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:536:in `eval_input'
25: from F:/Ruby27-x64/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `each_top_level_statement'
24: from F:/Ruby27-x64/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `catch'
23: from F:/Ruby27-x64/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `block in each_top_level_statement'
22: from F:/Ruby27-x64/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `loop'
21: from F:/Ruby27-x64/lib/ruby/2.7.0/irb/ruby-lex.rb:138:in `block (2 levels) in each_top_level_statement'
20: from F:/Ruby27-x64/lib/ruby/2.7.0/irb/ruby-lex.rb:166:in `lex'
19: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:517:in `block in eval_input'
18: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:695:in `signal_status'
17: from F:/Ruby27-x64/lib/ruby/2.7.0/irb.rb:518:in `block (2 levels) in eval_input'
16: from F:/Ruby27-x64/lib/ruby/2.7.0/irb/input-method.rb:262:in `gets'
15: from F:/Ruby27-x64/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
14: from F:/Ruby27-x64/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
13: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:174:in `readmultiline'
12: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:236:in `inner_readline'
11: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:236:in `loop'
10: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:237:in `block in inner_readline'
9: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:266:in `read_io'
8: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:266:in `loop'
7: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:307:in `block in read_io'
6: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:238:in `block (2 levels) in inner_readline'
5: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:238:in `each'
4: from F:/Ruby27-x64/lib/ruby/2.7.0/reline.rb:239:in `block (3 levels) in inner_readline'
3: from F:/Ruby27-x64/lib/ruby/2.7.0/reline/line_editor.rb:837:in `input_key'
2: from F:/Ruby27-x64/lib/ruby/2.7.0/reline/line_editor.rb:795:in `normal_char'
1: from F:/Ruby27-x64/lib/ruby/2.7.0/reline/line_editor.rb:721:in `process_key'
(irb):1:in `method': wrong number of arguments (given 1, expected 0) (ArgumentError)
but if I change its name, the bug fixed
after changing name, it ran correctly
I thought the reason of this bug is the method name in ruby can not be 'method'
but after I tried it in RubyMine 2020.2, it runned correctly
I am confused.
in RubyMine
You are overwriting the Object#method method. It is never a good idea to overwrite a core Ruby method.
In particular, both IRb and Pry support auto-completion while you type, they support documentation, and many other things. And guess what method they use to get a Method object that they can work with?
So, what is happening is that IRb is calling method(some_method_name) to get access to some method, but you have overwritten the Object#method method with a method that takes no argument.
Don't mess with Ruby's core methods. And if you are using IRb, especially don't mess with core methods that are used by IRb.

How to fix "Name or service not known(www.googleapis.com:443)"

Currently I'm updating an existing script that gets all the users in Google's AdminDirectoryV1.
This is working but suddenly it's returning errors:
Traceback (most recent call last):
27: from googletoldap_sync.rb:308:in `<main>'
26: from /usr/local/rvm/gems/ruby-2.5.5/gems/google-api-client-0.36.1/generated/google/apis/admin_directory_v1/service.rb:3740:in `list_users'
25: from /usr/local/rvm/gems/ruby-2.5.5/gems/google-api-client-0.36.1/lib/google/apis/core/base_service.rb:360:in `execute_or_queue_command'
24: from /usr/local/rvm/gems/ruby-2.5.5/gems/google-api-client-0.36.1/lib/google/apis/core/http_command.rb:102:in `execute'
23: from /usr/local/rvm/gems/ruby-2.5.5/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
22: from /usr/local/rvm/gems/ruby-2.5.5/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
21: from /usr/local/rvm/gems/ruby-2.5.5/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
20: from /usr/local/rvm/gems/ruby-2.5.5/gems/google-api-client-0.36.1/lib/google/apis/core/http_command.rb:110:in `block in execute'
19: from /usr/local/rvm/gems/ruby-2.5.5/gems/retriable-3.1.2/lib/retriable.rb:56:in `retriable'
18: from /usr/local/rvm/gems/ruby-2.5.5/gems/retriable-3.1.2/lib/retriable.rb:56:in `times'
17: from /usr/local/rvm/gems/ruby-2.5.5/gems/retriable-3.1.2/lib/retriable.rb:61:in `block in retriable'
16: from /usr/local/rvm/gems/ruby-2.5.5/gems/google-api-client-0.36.1/lib/google/apis/core/http_command.rb:113:in `block (2 levels) in execute'
15: from /usr/local/rvm/gems/ruby-2.5.5/gems/google-api-client-0.36.1/lib/google/apis/core/http_command.rb:302:in `execute_once'
14: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient.rb:854:in `request'
13: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient.rb:1104:in `follow_redirect'
12: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
11: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'
10: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
9: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'
8: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'
7: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient/session.rb:511:in `query'
6: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient/session.rb:748:in `connect'
5: from /usr/local/rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
4: from /usr/local/rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/timeout.rb:93:in `block in timeout'
3: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient/session.rb:752:in `block in connect'
2: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:21:in `create_socket'
1: from /usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient/session.rb:607:in `create_socket'
/usr/local/rvm/gems/ruby-2.5.5/gems/httpclient-2.8.3/lib/httpclient/session.rb:625:in `rescue in create_socket': getaddrinfo: Name or service not known (www.googleapis.com:443) (Google::Apis::TransmissionError)
I'm using the following gems:
require "google/apis/admin_directory_v1"
require "googleauth"
require "googleauth/stores/file_token_store"

Jekyll /gems/jekyll-4.0.0/lib/jekyll/cache.rb:171:in `load': end of file reached (EOFError)

when I try run jekyll serve --trace this error message appears:
Configuration file: /Users/John/Projects/contrast/_config.yml
Traceback (most recent call last):
19: from /usr/local/bin/jekyll:23:in `<main>'
18: from /usr/local/bin/jekyll:23:in `load'
17: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/exe/jekyll:15:in `<top (required)>'
16: from /Library/Ruby/Gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
15: from /Library/Ruby/Gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
14: from /Library/Ruby/Gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
13: from /Library/Ruby/Gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
12: from /Library/Ruby/Gems/2.6.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
11: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
10: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `process_with_graceful_fail'
9: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `each'
8: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/command.rb:89:in `block in process_with_graceful_fail'
7: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:30:in `process'
6: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/commands/build.rb:30:in `new'
5: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:33:in `initialize'
4: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/site.rb:113:in `reset'
3: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/cache.rb:41:in `clear_if_config_changed'
2: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/cache.rb:86:in `[]'
1: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/cache.rb:171:in `load'
/Library/Ruby/Gems/2.6.0/gems/jekyll-4.0.0/lib/jekyll/cache.rb:171:in `load': end of file reached (EOFError)
This is my important parts of my _confing.yml file:
title: "Blog Title"
author: "Blog Author"
permalink: /:title/
lang: "en"
date_format: "%B %d, %Y"
plugins:
- jekyll-feed
How can I solve this so jekyll can run normally ? Thank you for any help.
Cause
I run out of disk space during site generation and it made some corrupted files.
Solution
Solution to this problem was to delete _site and .jekyll-cache and directories and run jekyll serve --trace again. (Yes you have to delete both of them). Obviously I made more disk space to prevent this error.

timeout reading & writing data in firebase firestore

i'm encountering a Google::Cloud::DeadlineExceededError error when creating a document in Firebase Cloud Firestore using the ruby client.
Similar code has been working flawlessly up to this point. I've never seen a timeout before today, so i'm quite confused what could be going wrong.
other troubleshooting i've done:
i've updated to a pay-as-you-go Firestore plan, and i have verified that I am not exceeding any quotas. (So if this is rate-limiting it's some limit which isn't readily visible.)
the status page doesn't show any issues with Firestore currently. (10/24/2019)
has anyone run into similar behavior - an app is working fine, and then suddenly Firestore begins timing out?
i have a guess that perhaps i've triggered some rate-limiting, because this has only begun today when i've started hitting firestore with increased amounts of traffic. (trying to load test as i get closer to launching the app in production.) But I have zero actual evidence that this is the reason.
# bin/load-test
require "thor"
class LoadTest < Thor
desc "setup", "set up a game for load testing"
method_option :game, type: :string, required: true, aliases: '-g'
method_option :player_count, type: :numeric, required: true, aliases: '-c'
def setup
log = Logger.new($stdout, level: Logger::DEBUG)
root_dir = Pathname.new(File.expand_path('../..', __FILE__))
Google::Cloud::Firestore.configure do |config|
config.credentials = root_dir.join('firebase-credentials.json').to_s
end
game = db.doc("games/#{options[:game]}")
options[:player_count].times do
player_id = SecureRandom.hex
log.debug "creating player #{player_id}"
# =====> this is line 47 in the actual file. this is where the timeout happens.
game.collection('players').doc(player_id).set({is_active: true})
end
log.info "created #{options[:player_count]} player records."
end
end
LoadTest.start
$ bin/load-test setup --game 20191014-test-game --player-count 200
D, [2019-10-14T12:49:07.562328 #85721] DEBUG -- : creating player 10d81b445239d94e9d9f047ae3eee952
Traceback (most recent call last):
23: from bin/load-test:129:in `<main>'
22: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
21: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
20: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
19: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
18: from bin/load-test:44:in `setup'
17: from bin/load-test:44:in `times'
16: from bin/load-test:47:in `block in setup'
15: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/document_reference.rb:322:in `set'
14: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/client.rb:582:in `batch'
13: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/batch.rb:403:in `commit'
12: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:159:in `commit'
11: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:208:in `execute'
10: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:160:in `block in commit'
9: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/v1/firestore_client.rb:846:in `commit'
8: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-gax-1.7.1/lib/google/gax/api_callable.rb:260:in `block in create_api_call'
7: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-gax-1.7.1/lib/google/gax/api_callable.rb:230:in `block in create_api_call'
6: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-gax-1.7.1/lib/google/gax/api_callable.rb:401:in `block in add_timeout_arg'
5: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/grpc-1.24.0-universal-darwin/src/ruby/lib/grpc/generic/client_stub.rb:171:in `block in request_response'
4: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/grpc-1.24.0-universal-darwin/src/ruby/lib/grpc/generic/interceptors.rb:170:in `intercept!'
3: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/grpc-1.24.0-universal-darwin/src/ruby/lib/grpc/generic/client_stub.rb:172:in `block (2 levels) in request_response'
2: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/grpc-1.24.0-universal-darwin/src/ruby/lib/grpc/generic/active_call.rb:377:in `request_response'
1: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/grpc-1.24.0-universal-darwin/src/ruby/lib/grpc/generic/active_call.rb:181:in `attach_status_results_and_complete_call'
/Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/grpc-1.24.0-universal-darwin/src/ruby/lib/grpc/generic/active_call.rb:31:in `check_status': 4:Deadline Exceeded (GRPC::DeadlineExceeded)
16: from bin/load-test:129:in `<main>'
15: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
14: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
13: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
12: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
11: from bin/load-test:44:in `setup'
10: from bin/load-test:44:in `times'
9: from bin/load-test:47:in `block in setup'
8: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/document_reference.rb:322:in `set'
7: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/client.rb:582:in `batch'
6: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/batch.rb:403:in `commit'
5: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:159:in `commit'
4: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:208:in `execute'
3: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:160:in `block in commit'
2: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/v1/firestore_client.rb:846:in `commit'
1: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-gax-1.7.1/lib/google/gax/api_callable.rb:259:in `block in create_api_call'
/Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-gax-1.7.1/lib/google/gax/api_callable.rb:264:in `rescue in block in create_api_call': GaxError RPC failed, caused by 4:Deadline Exceeded (Google::Gax::DeadlineExceededError)
13: from bin/load-test:129:in `<main>'
12: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
11: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
10: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
9: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
8: from bin/load-test:44:in `setup'
7: from bin/load-test:44:in `times'
6: from bin/load-test:47:in `block in setup'
5: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/document_reference.rb:322:in `set'
4: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/client.rb:582:in `batch'
3: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/batch.rb:403:in `commit'
2: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:159:in `commit'
1: from /Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:207:in `execute'
/Users/alex/.rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/gems/google-cloud-firestore-1.1.0/lib/google/cloud/firestore/service.rb:211:in `rescue in execute': 4:Deadline Exceeded (Google::Cloud::DeadlineExceededError)
i believe the issue was writing much too frequently to a single document. i ended up deleting the containing collection and re-creating it. i've been following the "max 1 update/sec" rule since then and haven't had further problems.
https://cloud.google.com/firestore/docs/best-practices#updates_to_a_single_document

Is there way to find where(which file) defined certain method in ruby?

I have a cfndsl file with the statement:
SSESpecification(SSEEnabled: true)
on the local machine I get this error:
Traceback (most recent call last):
12: from /usr/local/bin/cfndsl:23:in `<main>'
11: from /usr/local/bin/cfndsl:23:in `load'
10: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/bin/cfndsl:138:in `<top (required)>'
9: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/lib/cfndsl.rb:87:in `eval_file_with_extras'
8: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/lib/cfndsl.rb:87:in `eval'
7: from /c/work/dfsi/infra/cfndsl/cadnsw.rb:5:in `eval_file_with_extras'
6: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/lib/cfndsl.rb:93:in `CloudFormation'
5: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/lib/cfndsl/jsonable.rb:204:in `declare'
4: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/lib/cfndsl/jsonable.rb:204:in `instance_eval'
3: from /c/work/dfsi/infra/cfndsl/cadnsw.rb:420:in `block in eval_file_with_extras'
2: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/lib/cfndsl/orchestration_template.rb:104:in `block (3 levels) in create_resource_accessor'
1: from /var/lib/gems/2.5.0/gems/cfndsl-0.16.9/lib/cfndsl/orchestration_template.rb:104:in `instance_eval'
/c/work/dfsi/infra/cfndsl/cadnsw.rb:470:in `block (2 levels) in eval_file_with_extras': undefined method `SSESpecification' for #<CfnDsl::AWS::Types::AWS_DynamoDB_Table:0x00007fffd918d478>
But on the server it is running OK without errors.
I just want to find out on server which file defined the method SSESpecification.
How should I do that with irb?

Resources