bark-worker icon indicating copy to clipboard operation
bark-worker copied to clipboard

错误码520

Open 0x032c opened this issue 3 months ago • 3 comments

这边按照你的教程一键部署cloudflare的woker,绑定了个自定义域名,register、ping、info等路由都没有问题,使用brak推送的时候就报错了{"code":520,"message":"push failed: error code: 520","timestamp":1759036016}

workers-observability日志如下:

{
  "source": {
    "level": "error",
    "message": "GET https://push.xx.com/REDACTED/%E8%BF%99%E9%87%8C%E6%94%B9%E6%88%90%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8E%A8%E9%80%81%E5%86%85%E5%AE%B9"
  },
  "dataset": "cloudflare-workers",
  "timestamp": "2025-09-28T05:11:55.944Z",
  "$workers": {
    "event": {
      "request": {
        "cf": {
          "requestHeaderNames": {},
          "isEUCountry": false,
          "httpProtocol": "HTTP/3",
          "clientAcceptEncoding": "gzip, deflate, br",
          "requestPriority": "",
          "colo": "AMS",
          "asOrganization": "Chinatelecom IPv6 address for mobile",
          "country": "CN",
          "city": "Shenzhen",
          "continent": "AS",
          "region": "Guangdong",
          "regionCode": "GD",
          "timezone": "Asia/Shanghai",
          "longitude": "114.0683",
          "latitude": "22.54554",
          "postalCode": "518000",
          "tlsVersion": "TLSv1.3",
          "tlsCipher": "AEAD-AES128-GCM-SHA256",
          "tlsClientRandom": "IsueRrU4168dXB2/I6CTLISJiOOGjf6+WPNdE/xaV1I=",
          "tlsClientCiphersSha1": "",
          "tlsClientExtensionsSha1": "XbnVtT2dC11p/dCZwA4MyoKnOqs=",
          "tlsClientExtensionsSha1Le": "",
          "tlsClientHelloLength": "254",
          "tlsClientAuth": {
            "certPresented": "0",
            "certVerified": "NONE",
            "certRevoked": "0",
            "certIssuerDN": "",
            "certSubjectDN": "",
            "certIssuerDNRFC2253": "",
            "certSubjectDNRFC2253": "",
            "certIssuerDNLegacy": "",
            "certSubjectDNLegacy": "",
            "certSerial": "",
            "certIssuerSerial": "",
            "certSKI": "",
            "certIssuerSKI": "",
            "certFingerprintSHA1": "",
            "certFingerprintSHA256": "",
            "certNotBefore": "",
            "certNotAfter": ""
          },
          "verifiedBotCategory": "",
          "edgeRequestKeepAliveStatus": 1,
          "clientTcpRtt": 0,
          "asn": 4134
        },
        "url": "https://push.xx.com/REDACTED/%E8%BF%99%E9%87%8C%E6%94%B9%E6%88%90%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8E%A8%E9%80%81%E5%86%85%E5%AE%B9",
        "method": "GET",
        "headers": {
          "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
          "accept-encoding": "gzip, br",
          "accept-language": "zh-CN,zh-Hans;q=0.9",
          "cf-connecting-ip": "240e:47f:34d0:287:1a5:46c2:54db:33ae",
          "cf-ipcountry": "CN",
          "cf-ray": "9860be2e8d48c13c",
          "cf-visitor": "{\"scheme\":\"https\"}",
          "connection": "Keep-Alive",
          "cookie": "REDACTED",
          "host": "push.xx.com",
          "priority": "u=0, i",
          "sec-fetch-dest": "document",
          "sec-fetch-mode": "navigate",
          "sec-fetch-site": "none",
          "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1",
          "x-forwarded-proto": "https",
          "x-real-ip": "240e:47f:34d0:287:1a5:46c2:54db:33ae"
        },
        "path": "/REDACTED/%E8%BF%99%E9%87%8C%E6%94%B9%E6%88%90%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8E%A8%E9%80%81%E5%86%85%E5%AE%B9"
      },
      "rayId": "9860be2e8d48c13c",
      "response": {
        "status": 520
      }
    },
    "diagnosticsChannelEvents": [],
    "truncated": false,
    "scriptName": "bark-worker",
    "outcome": "ok",
    "eventType": "fetch",
    "executionModel": "stateless",
    "scriptVersion": {
      "id": "386bf94f-e9b9-4a89-a86b-520922ea5456"
    },
    "requestId": "9860be2e8d48c13c",
    "cpuTimeMs": 3,
    "wallTimeMs": 1045
  },
  "$metadata": {
    "id": "01K67BR698FZ61SVEBARGG6711",
    "requestId": "9860be2e8d48c13c",
    "trigger": "GET /REDACTED/%E8%BF%99%E9%87%8C%E6%94%B9%E6%88%90%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8E%A8%E9%80%81%E5%86%85%E5%AE%B9",
    "service": "bark-worker",
    "level": "error",
    "error": "GET https://push.xx.com/REDACTED/%E8%BF%99%E9%87%8C%E6%94%B9%E6%88%90%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8E%A8%E9%80%81%E5%86%85%E5%AE%B9",
    "message": "GET https://push.xx.com/REDACTED/%E8%BF%99%E9%87%8C%E6%94%B9%E6%88%90%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8E%A8%E9%80%81%E5%86%85%E5%AE%B9",
    "account": "78698acb9ca538f3833ed1a93ba19105",
    "type": "cf-worker-event",
    "fingerprint": "3487bbd1ec7c7177cb4e062a800b38e0",
    "origin": "fetch",
    "messageTemplate": "GET https://push.xx.com/REDACTED/%E8%BF%99%E9%87%8C%E6%94%B9%E6%88%90%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%8E%A8%E9%80%81%E5%86%85%E5%AE%B9"
  },
  "links": []
}

更换域名依旧没有解决,域名waf白名单里面不会有任何拦截

大佬帮忙看看是什么问题

0x032c avatar Sep 28 '25 05:09 0x032c

> select * from devices
id	key	token
7	Pm0sD6X7vjGCirhjhfGMMh	d486904a394b932d64af59087f1f0979197010dd7076d7ccd09b51e3e4c962a9

GET https://push.xx.com/Pm0sD6X7vjGCirhjhfGMMh/aaa

RESPONSE { "code": 520, "message": "push failed: error code: 520", "timestamp": 1759039536 }

0x032c avatar Sep 28 '25 06:09 0x032c

该问题目前难以复现,因此无法提供准确支持

参考:https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/error-520/

cwxiaos avatar Sep 28 '25 08:09 cwxiaos

遇见了相同的问题,Worker接收后交给Bark程序处理时报错。

mylo114514 avatar Oct 21 '25 07:10 mylo114514

可以确认一下是否打开了 SSL/TLS -> Origin Server -> Authenticated Origin Pulls,如果打开了关闭即可

Halyul avatar Dec 04 '25 13:12 Halyul

一样的问题,一样的错误原因,使用自动生成的worker.dav域名推送就没问题,设置的自定义域名推送就失败,重构了两次,百分百复现相同问题,问了千问给了我下面的回到 “您的curl测试暴露了关键问题:当使用真实设备令牌(8V4LwaHkG5dhnmnrXrWH5n)时,Worker成功获取了令牌,但在向Apple推送通知(APNs)时失败,返回Cloudflare特有错误520。这与基础设施无关,而是Apple推送证书过期/失效导致的业务层故障。” 我就不明白了为什么默认域名就能推送成功,自定义域就不行,不知道现在有解决方法吗

HanQ2333 avatar Dec 06 '25 04:12 HanQ2333