mountainMath / cancensus

R wrapper for calling CensusMapper APIs
https://mountainmath.github.io/cancensus/index.html
Other
82 stars 15 forks source link

CRAN: error handling of STC certificate issues #170

Closed dshkol closed 2 years ago

dshkol commented 3 years ago

Seems once again CRAN maintainers are unhappy with errors due to examples failing due to SSL errors on Statistics Canada content.

Please correct before 2021-05-30 to safely retain your package on CRAN.

It seems we need to remind you of the CRAN policy:

'Packages which use Internet resources should fail gracefully with an informative message
if the resource is not available or has changed (and not give a check warning nor error).'

This needs correction whether or not the resource recovers.
Version: 0.4.2
Check: examples
Result: ERROR
    Running examples in ‘cancensus-Ex.R’ failed
    The error most likely occurred in:

    > ### Name: child_census_vectors
    > ### Title: List all child variables from vector hierarchies given either a
    > ### list of Census variables returned by 'list_census_vectors',
    > ### 'search_census_vectors', 'find_census_vectors', or a direct string
    > ### reference to the vector code.
    > ### Aliases: child_census_vectors
    >
    > ### ** Examples
    >
    > # Query parent vectors directly using vector identifier
    > child_census_vectors("v_CA16_2510")
    Error in curl::curl_fetch_memory(url, handle = handle) :
     SSL certificate problem: certificate has expired
    Calls: child_census_vectors ... request_fetch -> request_fetch.write_memory -> <Anonymous>
    Execution halted
mountainMath commented 3 years ago

That's a CensusMapper problem. Fixed now. The certificates get renewed automatically, but the web server does not get reloaded automatically. And sometimes I forget to do that manually. I really need to set this up to be fully automated.

dshkol commented 3 years ago

should we still do something on the package side for it "fail gracefully" as requested?

mountainMath commented 3 years ago

Maybe at some point? Not sure what “gracefully” means here, it should throw an error and stop execution when it can’t get the data. I think I just need to make sure the certificate on the server is fully automated.

dshkol commented 3 years ago

Seems errors are still there on the check page.

https://cran.r-project.org/web/checks/check_results_cancensus.html

I'm not sure if the tests have been re-run since your fix or not.

mountainMath commented 3 years ago

Pretty sure it just hasn't been re-run.

mountainMath commented 3 years ago

One way to fix this long term is to also exclude that vignette from compilation. Also, we could add a nightly GitHub action to run checks, that way we get notified early if there are any issues coming up.

dshkol commented 3 years ago

The error checks have come up clean now as predicted. I don't think this needs any changes, but let's get an update up to CRAN before the 31st with other changes.

dshkol commented 3 years ago

This is coming up again. I don't want to be at the mercy of BDR and Statscan's servers periodically. Let's consider either prebuilding the data discovery vignette or removing it from compilation (leaving it on the site).

https://cran.r-project.org/web/checks/check_results_cancensus.html https://mountainmath.github.io/cancensus/articles/data_discovery.html

mountainMath commented 3 years ago

I say we remove it from compilation.

Also, this is a CensusMapper problem, not statcan. My nginx setup is slightly messed up, the systemctrl start/stop commands don't work. so the web server does not get automatically restarted after certificate renewal, which happens every 3 months or so. If I forget to restart it manually it will give a certificate error when accessing it. Sometimes I forget and someone pings me about it and I restart the web server manually. I should fix this anyway, but let's also remove the vignette from compilation.