1

I am testing bitly in development environment with bitly package from npmjs, when I run bitly.shorten(link), I get the following error message:

{
  "message": "INVALID_ARG_LONG_URL",
  "resource": "bitlinks",
  "description": "The value provided is invalid.",
  "errors": [
    {
      "field": "long_url",
      "error_code": "invalid"
    }
  ]
}

The shortened url is http://localhost:3000/file/cto/pdf/en/2020-11-19/Presentation-Customer-AREVA-Hydrolic.pdf

Does bitly forbid the conversion of localhost links ?

I have tried to add https instead of http and this didn't work, I have checked at their documentation and didn't see any restriction.

I tought bitly was made for shortening long url.

Is this expected to fail or will it fail in production environment too since the URL is too long?

Dimitri Kopriwa
  • 13,139
  • 27
  • 98
  • 204

1 Answers1

8

Use http://127.0.0.1 instead of localhost. That worked for me.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83