APIs & Integrations

Aleluya
Participant

Request aborted

SOLVE

Hi! I was hitting the Hubspot API with Ruby successfully but then I started to get this response

 

Failed to open TCP connection to api.hubapi.com:443 (execution expired) (Net::OpenTimeout)

 

if I make the request from postman everything works but when I switch to Ruby for some reason I get that error, here is the code of my request

 

HTTParty.get("https://api.hubapi.com/conversations/v3/conversations/threads/26988XXXXX/messages?after=MTXXXXXXXXX", headers: { 'Authorization' => "Bearer #{@bearer_token}" })

 

and is not something of my internet because I tried with mobile data, I asked one of my peers and the got the same error

 

Am I doing something wrong?

1 Accepted solution
Humashankar
Solution
Key Advisor

Request aborted

SOLVE

Hi @Aleluya 

Looks like you are experiencing two separate issues.

 

Initially, the Net::OpenTimeout Error occurs when your Ruby script fails to connect to the HubSpot API within the specified timeout period. To resolve this, try increasing the timeout settings, as the default might be too short, especially if there's a slight network delay.

 

Next, the Authentication Error indicates invalid authentication credentials. To fix this, ensure your @bearer_token variable contains a valid OAuth 2.0 access token, check that the token hasn't expired and needs refreshing, and verify the Authorization header is in the correct format, Bearer <your_token>.

 

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Humashankar VJ
HubSpot Community Champion and enthusiast | Engineering Manager

View solution in original post

3 Replies 3
Humashankar
Solution
Key Advisor

Request aborted

SOLVE

Hi @Aleluya 

Looks like you are experiencing two separate issues.

 

Initially, the Net::OpenTimeout Error occurs when your Ruby script fails to connect to the HubSpot API within the specified timeout period. To resolve this, try increasing the timeout settings, as the default might be too short, especially if there's a slight network delay.

 

Next, the Authentication Error indicates invalid authentication credentials. To fix this, ensure your @bearer_token variable contains a valid OAuth 2.0 access token, check that the token hasn't expired and needs refreshing, and verify the Authorization header is in the correct format, Bearer <your_token>.

 

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Humashankar VJ
HubSpot Community Champion and enthusiast | Engineering Manager
Aleluya
Participant

Request aborted

SOLVE

im going to mark this as a solution but placing a timeout period didn't work looks like it was something related to my network, but I'm not pretty sure. but what it matters is that is working

Jaycee_Lewis
Community Manager
Community Manager

Request aborted

SOLVE

Hey, @Aleluya 👋  Thanks for your question. You can try opening an issue here https://github.com/HubSpot/hubspot-api-ruby/issues Hey, @zach_threadint @Humashankar do you have any Ruby-specific troubleshooting tip you can share with @Aleluya?

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot