Skip to content

Conversation

@tunetheweb
Copy link
Member

@tunetheweb tunetheweb commented Sep 16, 2025

Speculation Rules custom metric is causing the performance custom metric to fail with error sometimes with:

{"errorMessage":"Cannot convert undefined or null to object","errorName":"TypeError"}

Test websites:

@github-actions
Copy link

https://almanac.httparchive.org/en/2022/

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 548,
      "nodeName": "IMG",
      "url": "https://almanac.httparchive.org/static/images/home-hero.png",
      "size": 161505,
      "loadTime": 382.5,
      "renderTime": 548,
      "attributes": [
        {
          "name": "src",
          "value": "/static/images/home-hero.png"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "width",
          "value": "820"
        },
        {
          "name": "height",
          "value": "562"
        },
        {
          "name": "fetchpriority",
          "value": "high"
        }
      ],
      "boundingClientRect": {
        "x": 866,
        "y": 339.109375,
        "width": 485,
        "height": 332.390625,
        "top": 339.109375,
        "right": 1351,
        "bottom": 671.5,
        "left": 866
      },
      "naturalWidth": 820,
      "naturalHeight": 562,
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "relative",
        "width": "485px",
        "height": "332.391px"
      },
      "percentOfViewport": "0.173",
      "cover90viewport": false
    },
    "raw_lcp_element": {
      "nodeName": "IMG",
      "attributes": [
        {
          "name": "src",
          "value": "/static/images/home-hero.png"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "width",
          "value": "820"
        },
        {
          "name": "height",
          "value": "562"
        },
        {
          "name": "fetchpriority",
          "value": "high"
        }
      ]
    },
    "lcp_resource": {
      "id": "17207.10",
      "sequence": 10,
      "body": "/home/pmeenan/wptagent/work/wptagent-v6-manual-20241002-10.20.0.3/250916_Z2_H.1.0/bodies/17207.10",
      "url": "https://almanac.httparchive.org/static/images/home-hero.png",
      "status": 200,
      "connectionId": 154,
      "protocol": "h2",
      "connectionReused": true,
      "fromServiceWorker": false,
      "timing": {
        "requestTime": 54482.609706,
        "proxyStart": -1,
        "proxyEnd": -1,
        "dnsStart": -1,
        "dnsEnd": -1,
        "connectStart": -1,
        "connectEnd": -1,
        "sslStart": -1,
        "sslEnd": -1,
        "workerStart": -1,
        "workerReady": -1,
        "workerFetchStart": -1,
        "workerRespondWithSettled": -1,
        "sendStart": 4.853,
        "sendEnd": 5.521,
        "pushStart": 0,
        "pushEnd": 0,
        "receiveHeadersStart": 56.361,
        "receiveHeadersEnd": 56.497
      },
      "fromDiskCache": false,
      "remoteIPAddress": "[2607:f8b0:4004:c1f::79]",
      "remotePort": 443,
      "securityState": "secure",
      "securityDetails": {
        "protocol": "TLS 1.3",
        "keyExchange": "",
        "keyExchangeGroup": "X25519",
        "cipher": "AES_128_GCM",
        "certificateId": 0,
        "subjectName": "almanac.httparchive.org",
        "sanList": [
          "almanac.httparchive.org"
        ],
        "issuer": "WR3",
        "validFrom": 1757965358,
        "validTo": 1765744411,
        "signedCertificateTimestampList": [
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Google 'Xenon2025h2' log",
            "logId": "DDDCCA3495D7E11605E79532FAC79FF83D1C50DFDB003A1412760A2CACBBC82A",
            "timestamp": 1757968959197,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "3045022100B6EE105F9485B87FB5E57213C38AF4A443B942AFE858117CFCE980311DDC3E620220718C10D85732127F9EB3ECA34A81B4B8C3FAA8133D5B500BB92E42FDCA43FCEE"
          },
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Let's Encrypt 'Oak2025h2'",
            "logId": "0DE1F2302BD30DC140621209EA552EFC47747CB1D7E930EF0E421EB47E4EAA34",
            "timestamp": 1757968959165,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "3045022044163DC45994CDD7E02075065186A3911CC3E684914CDB642EBED299F1AAB8C0022100BB3CAF5A1FE55B735D6C7AE14F86C70FDFA3E118B740FA912758F467E8C840D6"
          }
        ],
        "certificateTransparencyCompliance": "compliant",
        "serverSignatureAlgorithm": 2052,
        "encryptedClientHello": false
      },
      "fromPrefetchCache": false,
      "response_headers": {
        "cache-control": "public, max-age=10800",
        "content-type": "image/png",
        "date": "Tue, 16 Sep 2025 21:13:56 GMT",
        "etag": "\"08Ot8Q\"",
        "expires": "Wed, 17 Sep 2025 00:13:56 GMT",
        "server": "Google Frontend",
        "strict-transport-security": "max-age=31556926; includeSubDomains",
        "vary": "Accept-Encoding",
        "x-cloud-trace-context": "d2cb973f52cf2329aa12feba8d572ba0",
        "x-content-type-options": "nosniff"
      },
      "request_headers": {
        ":authority": "almanac.httparchive.org",
        ":method": "GET",
        ":path": "/static/images/home-hero.png",
        ":scheme": "https",
        "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
        "accept-encoding": "gzip, deflate, br, zstd",
        "accept-language": "en-US,en;q=0.9",
        "priority": "u=1, i",
        "referer": "https://almanac.httparchive.org/en/2022/",
        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"140\", \"Google Chrome\";v=\"140\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Unknown\"",
        "sec-fetch-dest": "image",
        "sec-fetch-mode": "no-cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 PTST/250902.181938"
      },
      "initiator": {
        "type": "parser",
        "url": "https://almanac.httparchive.org/en/2022/",
        "lineNumber": 1425,
        "columnNumber": 99
      },
      "documentURL": "https://almanac.httparchive.org/en/2022/",
      "timestamp": 54482.596966,
      "frameId": "097C202023FDD5FFC75D2A1AC4280CB3",
      "hasUserGesture": false,
      "type": "Image",
      "wallTime": 1758057236.413625,
      "initialPriority": "High",
      "priority": "High",
      "transfer_size": 38172
    },
    "is_lcp_statically_discoverable": true,
    "is_lcp_preloaded": false,
    "lcp_preload": [],
    "web_vitals_js": [
      "https://almanac.httparchive.org/static/js/web-vitals.js?v=e7b8ecda99703fdc7c6a33b6a3d07cc6"
    ],
    "gaming_metrics": [],
    "speculation_rules": {
      "htmlRules": [
        {
          "prerender": [
            {
              "source": "document",
              "where": {
                "and": [
                  {
                    "href_matches": "/*"
                  },
                  {
                    "not": {
                      "href_matches": "/static/*"
                    }
                  }
                ]
              },
              "eagerness": "moderate"
            }
          ]
        }
      ],
      "httpHeaderRules": []
    }
  }
}
https://example.com

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 408,
      "nodeName": "P",
      "url": "",
      "size": 33858,
      "loadTime": 0,
      "renderTime": 408,
      "attributes": [],
      "boundingClientRect": {
        "x": 383,
        "y": 192.875,
        "width": 600,
        "height": 57,
        "top": 192.875,
        "right": 983,
        "bottom": 249.875,
        "left": 383
      },
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "static",
        "width": "600px",
        "height": "57px"
      },
      "percentOfViewport": "0.0368",
      "cover90viewport": false
    },
    "raw_lcp_element": null,
    "lcp_resource": null,
    "is_lcp_statically_discoverable": true,
    "is_lcp_preloaded": null,
    "lcp_preload": null,
    "web_vitals_js": [],
    "gaming_metrics": [],
    "speculation_rules": {
      "htmlRules": [],
      "httpHeaderRules": []
    }
  }
}
https://www.swp.de/lokales/horb/tanklaster-mit-loesungsmittel-brennt-400-einsatzkraefte-17-stunden-so-lief-der-grosseinsatz-auf-der-a-81-78186666.html

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 1344,
      "nodeName": "H1",
      "url": "",
      "size": 83712,
      "loadTime": 0,
      "renderTime": 1344,
      "attributes": [
        {
          "name": "class",
          "value": "mb-2 mt-0"
        },
        {
          "name": "data-v-f48ef0b3",
          "value": ""
        }
      ],
      "boundingClientRect": {
        "x": 198.5,
        "y": 461.59375,
        "width": 794,
        "height": 154.375,
        "top": 461.59375,
        "right": 992.5,
        "bottom": 615.96875,
        "left": 198.5
      },
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "static",
        "width": "794px",
        "height": "154.375px"
      },
      "percentOfViewport": "0.132",
      "cover90viewport": false
    },
    "raw_lcp_element": null,
    "lcp_resource": null,
    "is_lcp_statically_discoverable": true,
    "is_lcp_preloaded": null,
    "lcp_preload": null,
    "web_vitals_js": [
      "https://unpkg.com/web-vitals@3.5.2/dist/web-vitals.iife.js",
      "https://unpkg.com/web-vitals@5.1.0/dist/web-vitals.iife.js"
    ],
    "gaming_metrics": {
      "fidIframeOverlaySoft": false
    },
    "speculation_rules": {
      "htmlRules": [],
      "httpHeaderRules": []
    }
  }
}

@tunetheweb tunetheweb requested a review from pmeenan September 16, 2025 21:18
Copy link
Member

@pmeenan pmeenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tunetheweb tunetheweb merged commit ee2b1b1 into main Sep 16, 2025
4 checks passed
@tunetheweb tunetheweb deleted the tunetheweb-patch-1 branch September 16, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants