google-apis-identitytoolkit_v3 raises HTTPClient::ConnectTimeoutError

I’m using rails 7.0.3 and ruby 3.1.1, and I deploy my app to

I am using google-apis-identitytoolkit_v3 to get user information for firebase authentication from ruby.

client =
client.authorisation = Google::Auth::ServiceAccountCredentials.make_creds(
          scope: ''
        ) # I put required variables for auth in .env.production.
account_request = token)
account = client.get_account_info(account_request)

The above code works fine and gets the user information in the development environment, but I get a HTTPClient::ConnectTimeoutError on get_accout_info in the production environment.

I do not know why this happens.

As a test, I deployed the same application to heroku and tried it and it works fine.

I think this is a similar issue to: