lyc8503 / UptimeFlare

✔ Free and serverless uptime monitoring / status page on Cloudflare Workers, with Geo-specific checks
Apache License 2.0
1.87k stars 183 forks source link

Error calling worker #35

Closed Nicc0110 closed 6 months ago

Nicc0110 commented 6 months ago

So, I followed the documentation here and got the following IP: 8.24.87.22

I setup the A record (PROXIED) along with the protocol as HTTP. Using Postman I am able to make a GET request and get the following response

I looked before I posted this issue and found #19 and used the same website as in this comment to test it here and it responds to all pings.

The error logs are


  "outcome": "ok",
  "scriptVersion": {
    "id": "[REDACTED]"
  },
  "scriptName": "uptimeflare_worker",
  "diagnosticsChannelEvents": [],
  "exceptions": [],
  "logs": [
    {
      "message": [
        "Running scheduled event on LHR..."
      ],
      "level": "log",
      "timestamp": 1716778665662
    },
    {
      "message": [
        "[LHR] Checking Images Server..."
      ],
      "level": "log",
      "timestamp": 1716778665702
    },
    {
      "message": [
        "Calling worker: http://[REDACTED]"
      ],
      "level": "log",
      "timestamp": 1716778665702
    },
    {
      "message": [
        "Error calling worker: SyntaxError: Unexpected token 'e', \"error code: 521\" is not valid JSON"
      ],
      "level": "log",
      "timestamp": 1716778665833
    },
    {
      "message": [
        "Grace period (undefinedm) not met (currently down for 540s, changed false), skipping apprise DOWN notification for Images Server"
      ],
      "level": "log",
      "timestamp": 1716778665833
    },
    {
      "message": [
        "Calling config onIncident callback..."
      ],
      "level": "log",
      "timestamp": 1716778665833
    },
    {
      "message": [
        "statusChanged: false, lastUpdate: 1716778606, currentTime: 1716778666"
      ],
      "level": "log",
      "timestamp": 1716778665833
    },
    {
      "message": [
        "Skipping state update due to cooldown period."
      ],
      "level": "log",
      "timestamp": 1716778665833
    }
  ],
  "eventTimestamp": 1716778665648,
  "event": {
    "cron": "* * * * *",
    "scheduledTime": 1716778665000
  },
  "id": 2
}```
lyc8503 commented 6 months ago

It looks like the cause of the error is error code: 521, and the explanation provided by Cloudflare is: Error 521 occurs when the origin web server refuses connections from Cloudflare.

It looks like this IP is not available even though it can be pinged (which does happen sometimes), could you try another IP from the scan?

Nicc0110 commented 6 months ago

I tried another IP (8.20.125.2) and got error code 522, below I'll attach the logs


  "outcome": "ok",
  "scriptVersion": {
    "id": "[REDACTED]"
  },
  "scriptName": "uptimeflare_worker",
  "diagnosticsChannelEvents": [],
  "exceptions": [],
  "logs": [
    {
      "message": [
        "Running scheduled event on TPE..."
      ],
      "level": "log",
      "timestamp": 1716817486151
    },
    {
      "message": [
        "[TPE] Checking Images Server..."
      ],
      "level": "log",
      "timestamp": 1716817486355
    },
    {
      "message": [
        "Calling worker: http://[REDACTED]"
      ],
      "level": "log",
      "timestamp": 1716817486355
    },
    {
      "message": [
        "Error calling worker: SyntaxError: Unexpected token 'e', \"error code: 522\" is not valid JSON"
      ],
      "level": "log",
      "timestamp": 1716817525361
    },
    {
      "message": [
        "Grace period (undefinedm) not met (currently down for 1239s, changed false), skipping apprise DOWN notification for Images Server"
      ],
      "level": "log",
      "timestamp": 1716817525361
    },
    {
      "message": [
        "Calling config onIncident callback..."
      ],
      "level": "log",
      "timestamp": 1716817525361
    },
    {
      "message": [
        "statusChanged: false, lastUpdate: 1716817366, currentTime: 1716817486"
      ],
      "level": "log",
      "timestamp": 1716817525361
    },
    {
      "message": [
        "Skipping state update due to cooldown period."
      ],
      "level": "log",
      "timestamp": 1716817525361
    }
  ],
  "eventTimestamp": 1716817486138,
  "event": {
    "cron": "* * * * *",
    "scheduledTime": 1716817486000
  },
  "id": 1
}```
lyc8503 commented 6 months ago

Hmm... Error code 522 also indicated the origin server doesn't reply.

I noticed that the first IP(8.24.87.22) you chose doesn't fall in Cloudflare's ip list given.

8.24.87.0,8.24.87.6,US,United States,NA,North America,AS13335,"Cloudflare, Inc.",cloudflare.com starts at .0 and ends at .6, 8.24.87.22 is not included.

As for the second IP you chose, it is indeed in the IP list, but it really doesn't handle worker requests. Based on my comment above, this is possible, in which case you may need to try again and use another IP.

As I just tested, 8.45.41.30 should be an available worker IP in North America, you can try it.

(There really isn't much skill in this step, it may take some luck and trial and error...)

Nicc0110 commented 6 months ago

Yep, that IP did work, thank you for your help. Is there a list of working IPs or every time do I need to nmap it?

lyc8503 commented 6 months ago

Glad to see you got it sorted out. Most of the IPs in the list given so far should work in my experience, there may be a few non-working IPs mixed in with some regions, I haven't tested them all yet.