Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitly INVALID_URI - '500'

I am using the Bitly gem (https://github.com/philnash/bitly) for Bitly API Version 3

I get an error while shortening the URL when the application is deployed to Heroku. Locally the shortening works fine.

def get_short_url(url)
    Bitly.use_api_version_3
    bitly = Bitly.new(Settings.bitly.login, Settings.bitly.api_key)
    result = bitly.shorten(url) ----------------- Line 3
    result.short_url
end

Line 3 in the code above gives INVALID_URI - '500' error.

The URL I am trying to shorten is

"https://rs-4615.xyz.com/users/profile_view/20492083"

It shortens fine when I use bitly.com.

I am unable to figure out the issue. Can anyone help?

Shardul.

like image 385
SB. Avatar asked Nov 28 '12 03:11

SB.


1 Answers

Answering and accepting just in case someone else comes across the same issue.

The problem was that the URL generated in my code, did not PREPEND the 'https' protocol to the URL and so the failure.

So, what was generated was

rs-4615.xyz.com/users/profile_view/20492083 

INSTEAD OF

https://rs-4615.xyz.com/users/profile_view/20492083 -- This is the correct one.

@jstim, thanks for all your help.

like image 113
SB. Avatar answered Oct 05 '22 16:10

SB.