Leszek-Sieminski/pagespeedParseR

Instability in the pageSpeed API

Opened this issue · 4 comments

Hello Leszek,

Thanks for this very useful package!

I am testing it out and it works great for most URLs that I use. However, sometime I experience that the API returns NULL. I suppose this is some instability in the pageSpeed API, but I just wondered if you have had the same experience or any suggestions as to how to work around it?

I am using the download_lighthouse function.

Thanks
Christian

Hi Christian!
Thank you, such feedback makes it easier to me to keep up with open-source work :)

Regarding this issue, could you please:

  • check if the error always occur on the same URLs?
  • (if yes) provide me with a single URL example that fails on your side?
  • run session.info() in R's console and paste the output here?

This way I should be able to reproduce the errors.

Thanks in advance!

Best,
Leszek

Hi Leszek,

Thank you for your swift reply!

Here is an example that seems to cause problems;

 dt <- download_lighthouse(
      url = "https://www.cchobby.dk",
      output_type = "raw",
      strategy = c("mobile"),
      interval = 1,
      categories = c("accessibility", "best-practices", "performance", "pwa", "seo")
    )

I have made a re-try function which eventually works after 10-15 attempts.

By the way the function auth_pagespeed(api_key) didnt work for me but Sys.setenv(PAGESPEED_API_KEY = api_key) solved the problem.

Thanks
Christian

Oh I forgot:

> sessionInfo() R version 3.6.3 (2020-02-29) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 10 (buster)  Matrix products: default BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so  locale:  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8      [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=C              LC_PAPER=en_US.UTF-8       LC_NAME=C                   [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C         attached base packages: [1] stats     graphics  grDevices utils     datasets  methods   base       other attached packages: [1] googleCloudStorageR_0.5.1  data.table_1.12.8          pagespeedParseR_0.3.1.9000  loaded via a namespace (and not attached):  [1] zip_2.0.4              Rcpp_1.0.4.6           googleAuthR_1.2.1.9000 compiler_3.6.3         pillar_1.4.3            [6] prettyunits_1.1.1      remotes_2.1.1          tools_3.6.3            testthat_2.3.2         digest_0.6.25          [11] pkgbuild_1.0.6         pkgload_1.0.2          gargle_0.5.0           jsonlite_1.6.1         memoise_1.1.0          [16] tibble_3.0.1           lifecycle_0.2.0        pkgconfig_2.0.3        rlang_0.4.5            cli_2.0.2              [21] rstudioapi_0.11        yaml_2.2.1             curl_4.3               httr_1.4.1             withr_2.2.0            [26] dplyr_0.8.5            askpass_1.1            desc_1.2.0             fs_1.4.1               vctrs_0.2.4            [31] devtools_2.3.0         rprojroot_1.3-2        tidyselect_1.0.0       glue_1.4.0             R6_2.4.1               [36] processx_3.4.2         fansi_0.4.1            sessioninfo_1.1.1      tidyr_1.0.2            callr_3.4.3            [41] purrr_0.3.4            magrittr_1.5           backports_1.1.6        ps_1.3.2               ellipsis_0.3.0         [46] usethis_1.6.0          assertthat_0.2.1       openssl_1.4.1          crayon_1.3.4
--
 
> | >
>

.

Hi Leszek,

Thank you for your swift reply!

Here is an example that seems to cause problems;

 dt <- download_lighthouse(
      url = "https://www.cchobby.dk",
      output_type = "raw",
      strategy = c("mobile"),
      interval = 1,
      categories = c("accessibility", "best-practices", "performance", "pwa", "seo")
    )

I have made a re-try function which eventually works after 10-15 attempts.

By the way the function auth_pagespeed(api_key) didnt work for me but Sys.setenv(PAGESPEED_API_KEY = api_key) solved the problem.

Thanks
Christian

Hi Christian - following up on the above comment regarding the 'auth_pagespeed()' function, I'm consistently running into 404 errors of unknown origin. What specifically was 'not working' regarding your use of this function previously? Apologies for using the repo Issues for this question, but I could not find a more appropriate place to ask. Thank you

Also, thank you so much Leszek for putting this together! It will be very valuable once I get it up and running.