Open b-rodrigues opened 1 month ago
EDIT: it is likely due to some configuration on my work laptop, I’ll have to try on another machine. But would there be a way to circumvent this issue?
This kind of error usually is because you need to authenticate your predict()
API call. If you are using Posit Connect, it will typically look like this:
endpoint <- vetiver_endpoint("https://connect.example.com/content/$APP_ID/predict")
apiKey <- Sys.getenv("CONNECT_API_KEY")
predict(
endpoint,
new_data,
httr::add_headers(Authorization = paste("Key", apiKey))
)
Do you think you need pass in authentication details?
Thanks, but I don't think that's it, this is running locally. I think there might be some configuration on my work laptop that somehow blocks POST calls, I haven't had the chance to try on another machine yet
Ah gotcha, sorry that I missed that earlier. Yes, that sounds like something about your local setup. You may want to make a simpler example (maybe not even using R) to show IT folks that you can't test local API calls.
In terms of circumventing the problem, I wonder if you can authenticate somehow as the local user?
Thanks, but I don't think that's it, this is running locally. I think there might be some configuration on my work laptop that somehow blocks POST calls, I haven't had the chance to try on another machine yet
@b-rodrigues I had an idea. Can you try to make the calls from inside a running docker container?
Thanks, but I don't think that's it, this is running locally. I think there might be some configuration on my work laptop that somehow blocks POST calls, I haven't had the chance to try on another machine yet
@b-rodrigues I had an idea. Can you try to make the calls from inside a running docker container?
That’s a great idea, and indeed, doing the call from an R session running inside a container to the api running from the same container succeeds!
Ah gotcha, sorry that I missed that earlier. Yes, that sounds like something about your local setup. You may want to make a simpler example (maybe not even using R) to show IT folks that you can't test local API calls.
Yes, there’s definitely something going on, I’ll try to set something up and show it to them, see what can be done.
In terms of circumventing the problem, I wonder if you can authenticate somehow as the local user?
You mean, using my windows user credentials?
Hello
trying to predict from an endpoint results in the following error:
The model is a {glmnet} model trained using a {tidymodels} workflow and with {targets}.
I can use the web interface to get my predictions:
but trying from an R session using
predict()
on a data.frame results in the error above.This is what I’m doing: the fitted workflow is saved in a variable which I passed to
vetiver_model()
and calledmodel_to_deploy
:Now I serve the model locally using
{plumber}
:from another R session, I load some test data and remove the target:
and define the endpoint:
finally, I try to predict:
What am I missing?
EDIT:
Actually I just tried running the example from the readme and get the same error. I’m testing this on my work windows laptop, could this somehow be related?