bundlesize
bundlesize copied to clipboard
bundlesize failing because google api call 403ing.
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
May be related to:
https://www.engadget.com/2018/03/30/google-shutting-down-goo-gl-url-shortening-service/
Whoops, this is terrible
@karanjthakkar Ideas?
@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:
- Use another service 🤷♀️ like bitly or something
- extend the bundlesize now app to include two more endpoints:
- /shorten to shorten the url and save the hash to firebase (which we already have setup)
- /redirect/
to fetch from firebase and redirect to that url (In fact, come to think of it, now that we have to make a change, it might be a good idea that instead of saving the url, we directly save the info
and render it at that hash url directly)
I like option 1 because it's the least amount of change
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 😄