Pages deployment no longer loading astro site

I just recent updated an in-development website I am working on and am no longer able to get anything to load when I attempt to access the preview page for it. I reverted any changes that would have been in the recent deployment and am still unable to access the site at the preview url.

After checking the Real-Time Logs I am noticing this exception.

{
  "outcome": "exception",
  "scriptName": "pages-worker--1073331-preview",
  "diagnosticsChannelEvents": [],
  "exceptions": [
    {
      "name": "TypeError",
      "message": "Failed to execute 'encode' on 'TextEncoder': parameter 1 is not of type 'String'.",
      "timestamp": 1689985185612
    }
  ],
  "logs": [],
  "eventTimestamp": 1689985185611,
  "event": {
    "request": {
      "url": "https://f77ca6e8.priocare.pages.dev/",
      "method": "GET",
      "headers": {
        "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
        "accept-encoding": "gzip",
        "accept-language": "en-US,en;q=0.5",

...

I am not sure if this is a recent issue with Pages or something that would need addressing on my end. I have a feeling that because the reverted version of the site still does not load properly that it may be something with the Pages system. The automated github deploy completed successfully without any errors.

Any help would be much appreciated. Thank you in advance!

This is Function code so this is something either in your code or in Astro and not to do with Pages itself.

Something is calling TextEncoder#encode but with an invalid type as the first parameter (e.g. new TextEncoder().encode(1) instead of new TextEncoder().encode('1'))