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

Error using byFileAOP #62

Open
eastenw opened this issue Feb 14, 2023 · 3 comments
Open

Error using byFileAOP #62

eastenw opened this issue Feb 14, 2023 · 3 comments
Assignees

Comments

@eastenw
Copy link

eastenw commented Feb 14, 2023

Hi, I'm trying to explore LiDAR data but am having problem when trying to run:

byFileAOP("DP1.30003.001", site="TREE",year = "2022", check.size =T)

Currently getting an error:
Error: lexical error: invalid char in json text. <!DOCTYPE html PUBLIC "-//W3C// (right here) ------^

I am new to R, so I may be missing something. Thanks

@cklunch cklunch self-assigned this Feb 14, 2023
@cklunch
Copy link
Collaborator

cklunch commented Feb 14, 2023

@eastenw Thanks for reaching out! I'm having some trouble replicating this error, so I have two suggestions for troubleshooting.

  1. Sometimes errors like this can happen when the download times out. Try increasing the timeout in R: options(timeout=300). The value is in seconds, the default is 60. Downloading NEON AOP data is slow, so increasing the timeout can help.
  2. If the timeout doesn't get rid of the error, can you run the code below and report back on what happens?
req <- httr::GET('https://data.neonscience.org/api/v0/data/DP1.30003.001/TREE/2022-06')
av <- jsonlite::fromJSON(httr::content(req, as='text'))
for(i in 1:nrow(av$data$files)) {
  res <- try(httr::HEAD(av$data$files$url[i]), silent=T)
  if(inherits(res, 'try-error')) {
    print(av$data$files$name[i])
  }
}

The first two lines grab the file metadata from the API, so if you have an error there we'll know there's a problem with your connection. If the first two lines are successful, then the for loop will tell us which file is throwing the error.

@eastenw
Copy link
Author

eastenw commented Feb 14, 2023

Hi, thanks for getting back

There is a connection problem:
req <- httr::GET('https://data.neonscience.org/api/v0/data/DP1.30003.001/TREE/2022-06') Error in curl::curl_fetch_memory(url, handle = handle) : schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid

Please let me know if you have any suggestions.

@cklunch
Copy link
Collaborator

cklunch commented Feb 15, 2023

@eastenw Thanks for the additional info. The most likely scenario is that this has something to do with the security settings on either your machine or your network. It's very similar to what a couple of people have reported in #121 in the NEON-utilities repo.

Next things to try:

  • Clear your R environment and try again
  • Make sure your versions of curl and httr are up to date
  • Make sure your version of R is up to date
  • Try using a different network, especially if your work network has aggressive security
  • Adjust the firewall/security settings on your computer, or consult your IT department to do this

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