Closed smnorris closed 1 year ago
Also, the cached result that the test evaluates against responses looks problematic:
https://github.com/poissonconsulting/fwapgr/blob/main/tests/testthat/_snaps/index-point/default.csv
bc_ind
should be true for everything in BC but the snap has value of False
Perhaps that part of the function was not working correctly when the data was cached?
I'm getting this error
library(fwapgr)
fwa_index_point(x = -124.6, y = 54.8)
#> Error in `get_request()`:
#> ! API request failed [500]: Unable to read data from: postgisftw.fwa_indexpoint
#> .
#> Backtrace:
#> ▆
#> 1. └─fwapgr::fwa_index_point(x = -124.6, y = 54.8)
#> 2. └─pgfeatureserv::pgf_function_result(...) at fwapgr/R/index-point.R:45:2
#> 3. └─pgfeatureserv:::get_request(url = url, user = user, verbose = verbose)
#> 4. └─pgfeatureserv:::chk_response_status(resp)
#> 5. └─chk::abort_chk(glue("API request failed [{cd}]: {msg}"))
#> 6. └─chk::err(..., n = n, tidy = tidy, .subclass = "chk_error", call = call)
#> 7. └─rlang::abort(msg, class = .subclass, !!!args[named], call = call)
Created on 2022-11-24 with reprex v2.0.2
And when I enter
into a browser I get
Unable to read data from: postgisftw.fwa_indexpoint
@smnorris - will modifying he function to default to 4326 fix this issue?
Fixed, it was a replication and permissions issue:
pg_featureserv[498174]: time="2022-11-24T08:49:37-08:00" level=warning msg="Error scanning rows for Features: ERROR: permission denied for table fwa_stream_networks_sp (SQLSTATE 42501)"
Looking into the logs, replication failed in an unexpected way. Since permissions for pg_fs to view the tables need to be updated on every refresh and are granted only after full replication of the FWA data, they didn't get updated.
I'll make sure grants are applied to individual FWA tables immediately on load.
Thanks @smnorris
It looks like the first test will currently fail because function requires a CRS/SRID value.
https://github.com/poissonconsulting/fwapgr/blob/9578be566c48e46e0f8d75bb052a6ce8542ac28d/tests/testthat/test-index-point.R#L1
https://features.hillcrestgeo.ca/fwa/functions/postgisftw.fwa_indexpoint/items.json?x=-124.6&y=54.8&srid=4326
Let me know if you'd like to modify the function to default to 4326.