Skip to content

TypeError: Cannot read properties of undefined (reading 'transferSize') #65

Description

When running @cloudflare/speedtest in the browser, i receive this warning:
TypeError: Cannot read properties of undefined (reading 'transferSize')

This happens intermittently:

  • On first page load,
  • On refresh it often works fine.

Looking at the Performance API, the transferSize property is not always guaranteed:

  • For cross-origin requests without proper Timing-Allow-Origin headers
  • When resources are served from cache

Because the library directly assumes transferSize exists, it sometimes throws.

Steps to reproduce

  • Run @cloudflare/speedtest in a React/Next/Vite app
  • Observe console logs on first page load
  • Sometimes error appears, sometimes not
  • Refresh the page → the error disappears

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions