Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inaccessible geographies #6

Closed
bdbmax opened this issue Oct 6, 2022 · 5 comments
Closed

Inaccessible geographies #6

bdbmax opened this issue Oct 6, 2022 · 5 comments

Comments

@bdbmax
Copy link
Contributor

bdbmax commented Oct 6, 2022

Thanka a lot for this package, I look forward to using it to have much easier access to CMHC data!

While I can access data using cmhc::get_cmhc, I cannot access geographies using cmhc::get_cmhc_geography. It looks like the endpoint to the AWS bucket isn't right:

> cmhc::set_cmhc_cache_path("~/cmhc_cache", install = TRUE, overwrite = TRUE)
Your original .Renviron will be backed up and stored in your R HOME directory if needed.
Your cache path has been stored in your .Renviron and can be accessed by Sys.getenv("CMHC_CACHE_PATH").
[1] "~/cmhc_cache"
> cmhc::get_cmhc_geography(level = "ZONE")
Downloading geographies, this may take a minute...
List of 6
 $ Code     : chr "PermanentRedirect"
 $ Message  : chr "The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future "| __truncated__
 $ Endpoint : chr "mountainmath.s3.amazonaws.com"
 $ Bucket   : chr "mountainmath"
 $ RequestId: chr "DEVEV28Z0WV4E5FB"
 $ HostId   : chr "Wpn6zIAqge9ld7WR4zrY1cNmhGwV9tTfvVVw16Kxk6FVrY0AyYmfDrl+7xbYbTnbbeyZC7KTAG0="
 - attr(*, "headers")=List of 7
  ..$ x-amz-bucket-region: chr "ca-central-1"
  ..$ x-amz-request-id   : chr "DEVEV28Z0WV4E5FB"
  ..$ x-amz-id-2         : chr "Wpn6zIAqge9ld7WR4zrY1cNmhGwV9tTfvVVw16Kxk6FVrY0AyYmfDrl+7xbYbTnbbeyZC7KTAG0="
  ..$ content-type       : chr "application/xml"
  ..$ transfer-encoding  : chr "chunked"
  ..$ date               : chr "Thu, 06 Oct 2022 17:26:01 GMT"
  ..$ server             : chr "AmazonS3"
  ..- attr(*, "class")= chr [1:2] "insensitive" "list"
 - attr(*, "class")= chr "aws_error"
NULL
Error in parse_aws_s3_response(r, Sig, verbose = verbose) : 
  Moved Permanently (HTTP 301).
In addition: Warning message:
In dir.create(file.path(base_directory)) :
  'C:\Users\maxim\OneDrive - McGill University\Documents\cmhc_cache' already exists

Let me know if there's any more information from my end you'd need me to share.

Thank you!

@mountainMath
Copy link
Owner

Thanks for flagging, will look into this.

@mountainMath
Copy link
Owner

Ok, looks like I disabled public access to the S3 bucket at some point. I think I fixed that and it should work now. Please let me know if it continues to make problems.

Additionally I found a problem that on first run it would report the the download failed. But when running again everything will be fine. This is fixed on the v0.2.3 branch and will get updated on CRAN with the next update.

@bdbmax
Copy link
Contributor Author

bdbmax commented Oct 7, 2022

It seems to still not be working. It returns the exact same error (on both main and v0.2.3 branch)!

@mountainMath
Copy link
Owner

Ok, thanks for bearing with me. I think I figured out the root cause, I did not properly set the S3 bucket region for the data and my environment variables were masking that. It should now work on the v0.2.3 branch. Can you give it another try?

@bdbmax
Copy link
Contributor Author

bdbmax commented Oct 7, 2022

I confirm, it's fixed! Thanks for the quick answer, and thanks again for this package!

@bdbmax bdbmax closed this as completed Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants