Error 1101: Worker Threw Expection

Hello, one of my workers https://worker-daily-limit-exceeded.submarine.workers.dev/ keeps throwing expectation errors that look something like this

When I view the worker logs it does show an expection was thrown and the following detals are returned (with sensitive infomation redacted)

 "outcome": "exception",
  "scriptName": null,
  "exceptions": [
    {
      "name": "ReferenceError",
      "message": "handleRequest is not defined",
      "timestamp": 1637327883831
    }
  ],
  "logs": [],
  "eventTimestamp": 1637327883831,
  "event": {
    "request": {
      "url": "https://worker-daily-limit-exceeded.submarine.workers.dev/favicon.ico",
      "method": "GET",
      "headers": {
        "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
        "accept-encoding": "gzip",
        "accept-language": "en-US,en;q=0.9",
        "cf-connecting-ip": "{REDACTED}",
        "cf-ipcountry": "{REDACTED}",
        "cf-ray": "6b09b8e9eea5ec82",
        "cf-visitor": "{\"scheme\":\"https\"}",
        "connection": "Keep-Alive",
        "dnt": "1",
        "host": "worker-daily-limit-exceeded.submarine.workers.dev",
        "referer": "https://worker-daily-limit-exceeded.submarine.workers.dev/",
        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"96\", \"Google Chrome\";v=\"96\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Chrome OS\"",
        "sec-fetch-dest": "image",
        "sec-fetch-mode": "no-cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (X11; CrOS x86_64 14268.39.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.51 Safari/537.36",
        "x-forwarded-proto": "https",
        "x-real-ip": "{REDACTED}"
      },
      "cf": {
        "longitude": "{REDACTED}",
        "latitude": "{REDACTED}",
        "tlsCipher": "AEAD-AES128-GCM-SHA256",
        "continent": "NA",
        "asn": {REDACTED},
        "clientAcceptEncoding": "gzip, deflate, br",
        "country": "{REDACTED}",
        "tlsClientAuth": {
          "certIssuerDNLegacy": "",
          "certIssuerSKI": "",
          "certSubjectDNRFC2253": "",
          "certSubjectDNLegacy": "",
          "certFingerprintSHA256": "",
          "certNotBefore": "",
          "certSKI": "",
          "certSerial": "",
          "certIssuerDN": "",
          "certVerified": "NONE",
          "certNotAfter": "",
          "certSubjectDN": "",
          "certPresented": "0",
          "certRevoked": "0",
          "certIssuerSerial": "",
          "certIssuerDNRFC2253": "",
          "certFingerprintSHA1": ""
        },
        "tlsExportedAuthenticator": {
          "clientFinished": "f79ab976b6e853d774c479aee5f9f1b3706320040dd8188a53079fcb3df59e05",
          "clientHandshake": "8fcbaa8dd8b0d4c2cd5744dfe4e6b749fe202c56d6b4a21d4c59bf249cbf1d9e",
          "serverHandshake": "6c28ca24105945c87143cf92f5169fdce20d7d5f3a3b946749f0e9a94159f579",
          "serverFinished": "f9e34e6502d376fef93873860bab01ac56de648ab0667d444a7420ebf60b671a"
        },
        "tlsVersion": "TLSv1.3",
        "colo": "DFW",
        "timezone": "{REDACTED}",
        "city": "{REDACTED}",
        "edgeRequestKeepAliveStatus": 1,
        "requestPriority": "",
        "httpProtocol": "HTTP/3",
        "region": "{REDACTED}",
        "regionCode": "{REDACTED}",
        "asOrganization": "Sparklight",
        "metroCode": "{REDACTED}",
        "postalCode": "{REDACTED}"
      }
    }
  },
  "id": 1
}

Also, here’s the worker’s code

addEventListener("fetch", (event) => {
  event.respondWith(
    handleRequest(event.request).catch(
      (err) => new Response(err.stack, { status: 1027 })
    )
  );
});

Is there something wrong with the worker’s code or is it throwing an exception for some weird reason?

You don’t have a function called handleRequest Exactly as the error message says

So I add it in? But where?

You can add it below. Have a look at your other workers or the docs for what it should look like.

1 Like