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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With