Skip to content

Error: Cannot read properties of undefined (reading 'name')Β #55

@gentlee

Description

@gentlee

Reproduce steps:

  1. Enable sampling profiler on android device (Xiaomi Redmi Go)
  2. Disable it
  3. Download .cpuprofile
  4. Transform with transform script (without source maps)
  5. Try upload to chrome dev performance tab
  6. Got the error

Input: sampling-profiler-trace3882871943179202698.cpuprofile
Output (unzip): chrome-supported.json.zip

Transform script:

/**
 * Used to transform hermes profiler outputs to supported by chrome dev tools.
 * https://github.com/react-native-community/hermes-profile-transformer
 */

const transformer = require('hermes-profile-transformer').default
const { writeFileSync } = require('fs')

const hermesCpuProfilePath = 'sampling-profiler-trace3882871943179202698.cpuprofile'

transformer(
  // profile path is required
  hermesCpuProfilePath
  // source maps are optional
  // sourceMap,
  // sourceMapBundleFileName
)
  .then((events) => {
    // write converted trace to a file
    return writeFileSync('./chrome-supported.json', JSON.stringify(events, null, 2), 'utf-8')
  })
  .catch((err) => {
    console.log(err)
  })

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