Hi triblondon,
Thanks for helping with this.
I tried removing those toString()
calls and it did not resolve the issue. I also tried to trigger the error by making a new Headers object with some random entries and then copying it like I have been doing, but this does not cause the error:
I also tried doing things with a Map
object like this and got the same error:
let mappedHeaders = new Map();
logMessage("ATTACHING HEADERS----------------:")
for (const headerKey of req.headers.keys()) {
mappedHeaders.set(headerKey, req.headers.get(headerKey));
logMessage("HEADER KEY: ".concat(headerKey).concat(" ---> ").concat(req.headers.get(headerKey)));
}
for(const item of mappedHeaders)
{
logMessage(item);
}
let backendResponse = await fetch(backendPathAndParams, {
method: "GET",
backend: "backend_e",
headers: mappedHeaders,
})
For reference this is what the outputs are from the map, I don’t see anything which is malformed/not UTF-8?
Log: ["host", "127.0.0.1:7676"]
Log: ["user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0"]
Log: ["accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"]
Log: ["accept-language", "en-US,en;q=0.5"]
Log: ["accept-encoding", "gzip, deflate, br"]
Log: ["connection", "keep-alive"]
Log: ["upgrade-insecure-requests", "1"]
Log: ["sec-fetch-dest", "document"]
Log: ["sec-fetch-mode", "navigate"]
Log: ["sec-fetch-site", "none"]
Log: ["sec-fetch-user", "?1"]
Are there any flags I can pass to the Fastly CLI to see exactly what it’s trying to parse? Or have it emit more information about the error?