bundlesize icon indicating copy to clipboard operation
bundlesize copied to clipboard

bundlesize failing because google api call 403ing.

Open dzearing opened this issue 6 years ago • 5 comments

Do you want to request a feature or report a bug? bug

What is the current behavior? bundlesize doesn't work because of googleapi 403s.

The actual console logging shows this:

Unhandled Promise
TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at debug (/Users/david/fabric/branch5/common/temp/node_modules/bundlesize/src/debug.js:7:41)
    at shortener.shorten.then.catch.err (/Users/david/fabric/branch5/common/temp/node_modules/bundlesize/src/reporter.js:89:7)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

The real error occurs in this code, which has no error handling:

const shorten = longUrl =>
  axios({
    method: 'POST',
    url: `${url}?key=${googleApiKey}`,
    data: {
      longUrl
    }
  })

If the current behavior is a bug, please provide the steps to reproduce. Run bundlesize.

What is the expected behavior? https://github.com/siddharthkp/bundlesize/blob/master/src/shortener.js This file has a hardcoded api key. Maybe it shouldn't be. It throws up now, blocking checkins.

If this is a feature request, what is motivation or use case for changing the behavior? I would like bundlesize to work.

Please mention other relevant information.

  • node version
  • npm version
  • Operating system
  • bundlesize version
  • CI you are using

dzearing avatar Apr 17 '18 17:04 dzearing

May be related to:

https://www.engadget.com/2018/03/30/google-shutting-down-goo-gl-url-shortening-service/

dzearing avatar Apr 17 '18 19:04 dzearing

Whoops, this is terrible

@karanjthakkar Ideas?

siddharthkp avatar May 02 '18 11:05 siddharthkp

@siddharthkp That sucks! Did goog send you an email to inform you that the service may be shutting down? 🤔 Regardless I can see two options:

  1. Use another service 🤷‍♀️ like bitly or something
  2. extend the bundlesize now app to include two more endpoints:

karanjthakkar avatar May 02 '18 11:05 karanjthakkar

I like option 1 because it's the least amount of change

siddharthkp avatar May 02 '18 21:05 siddharthkp

Is there any plans to fix this? According to google, the service will be shut down in March 2019. Reading through the code, looks like the shortener has some hardcoded values for Google APIs.

Does it make sense to use environment variables instead? I'll gladly open a PR to help migrate it, but maybe makes sense to discuss this before 😄

victorhqc avatar Dec 17 '18 18:12 victorhqc