I’ve just started to see errors in my edge function. These aren’t caused by a deployment, so it seems something changed in edge functions themselves or the response payloads they receive.
The error is:
TypeError: request or response body error: error reading a body from connection: stream error received: not a result of an error
at readableStreamCollectIntoUint8Array (ext:deno_web/06_streams.js:869:28)
at InnerBody.consume (ext:deno_fetch/22_body.js:160:14)
at consumeBody (ext:deno_fetch/22_body.js:239:34)
at OriginResponse.text (ext:deno_fetch/22_body.js:318:16)
at addHtmlSecurityHeaders (file:///root/netlify/edge-functions/add-html-security-headers.js:12:33)
at eventLoopTick (ext:core/01_core.js:183:11)
at async FunctionChain.runFunction (file:///root/src/bootstrap/function_chain.ts:390:22)
at async FunctionChain.run (file:///root/src/bootstrap/function_chain.ts:310:20)
at async handleRequest (file:///root/src/bootstrap/handler.ts:80:22)
at async Server.#respond (https://deno.land/std@0.170.0/http/server.ts:299:18)
It appears to be triggered by this line in my code, which was working fine until now. It may be that the response is bodiless, but that would be new behaviour (and I’m not in a position to dig much right now).
I have the edge function in manual cache mode, so I guess maybe that broke? Please note, this is not a problem with my edge function (as I understand them). Something changed in how they’re run. My site has been down for several hours now, and I’d rather not bypass this function.
I’ve marked as complete, but I’m afraid I can’t verify. I switched to templating a _headers file into my public directory instead. Edge functions have proven to have too many edge cases for me!