Currently, calling HttpService:RequestAsync with a Url set to a secret will create an “Unable to cast value to std::string” error. This seems to NOT happen with local secrets, only when published to a game.
This place file reproduces when published to a game with the following secrets set:
- Name: “base_url”, Secret: “https://kernel.org”, Domain: “*”
- Name: “key”: Secret: “foobar”, Domain: “*”
Place File:
secreturlcasterror.rbxl (65,5 Kt)
Server Output:
The script contained within the place:
local HttpService = game:GetService("HttpService")
local secretBaseUrl = HttpService:GetSecret("base_url")
local secretHeader = HttpService:GetSecret("key")
local function printResponse(resp)
if not resp.Success then
print("Request failed")
return
end
local body
if string.len(resp.Body) > 100 then
body = string.sub(resp.Body, 0, 100)
else
body = resp.Body
end
print("Request successful: ", body)
end
local respNoSecrets = HttpService:RequestAsync({
Url = "https://kernel.org",
Method = "GET",
Headers = {
secretheader = "foobar"
}
})
printResponse(respNoSecrets)
local respPublicUrl = HttpService:RequestAsync({
Url = "https://kernel.org",
Method = "GET",
Headers = {
secretheader = secretHeader
}
})
printResponse(respPublicUrl)
local respSecretUrl = HttpService:RequestAsync({
Url = secretBaseUrl,
Method = "GET",
Headers = {
secretheader = secretHeader
}
})
printResponse(respSecretUrl)
Expected behavior
We expect the request to not return this error. Up until yesterday, this worked without issue.
A private message is associated with this bug report
