WhoBuilt

The day I broke React Native

Sep 22, 2023· 24 min· 1.4K views·Watch on YouTube

Speaker

Nicola Corti, an Android engineer on the React Native team at Meta, explains how a React Native release caused Android build failures at React Native EU 2023, hosted by Callstack.

A release triggers unexpected failures

The release crew began preparing React Native 0.71 release candidate 0 on November 4, 2022. The release included a change to publish Android artifacts through Maven Central because the npm package had grown to about 130 MB and was approaching npm’s 200 MB limit.

Dynamic versions made old projects vulnerable

Android projects and many React Native libraries used a plus sign as the dependency version, which lets Gradle select the highest version it can find. Moving the artifacts to Maven Central meant a newer published version could override the version bundled with an older React Native project. Corti calls this a ticking bomb that went unnoticed until the release.

The team works to restore builds

Changing only an app’s dependency was insufficient because libraries such as Reanimated also declared dynamic React Native dependencies. Corti and the release crew shared a Gradle script to mitigate the issue, then published patch releases for versions down to 0.63, covering 99% of the market share at the time. Sonatype removed the problematic Maven Central artifacts, resolving the issue.

Lessons for support and incident response

The team added safeguards to the React Native Gradle Plugin and established a support window focused generally on the latest three minor versions, which covered 75% of usage. Corti says the team was slow to escalate because it had no telemetry on community builds, and now also watches social platforms for reports. He also points to inconsistent library build scripts and plans to work with Callstack and the community on better library tooling guidance.

Release timing and incident readiness

Corti’s advice is not to release on Friday, though in this case the weekend gave the team time to investigate and ship fixes before Monday. He also notes that airplane Wi-Fi made incident response harder. The team had attempted the release seven times over the week before it succeeded.

Takeaways

  • Pin dependency versions so builds do not change when a new library release appears.
  • Check how native dependencies from libraries affect version resolution, not just the app’s own build file.
  • Define which older releases the team will support and have a way to detect problems in the community.
  • Build safeguards into release tooling and give releases time for a response if they cause regressions.

Mentioned in this talk

Search inside this talk

What was claimed 7

  • role at
    Nicola Corti is Android engineer at React Native
    “I work as an Android engineer on the React Native team.”
    YouTube
    Unverified1 source· Talk
  • uses
    “We decided to move to Maven Central.”
    YouTube
    Unverified1 source· Talk
  • metric
    npm: Rejects packages above 200 megabytes
    “npm doesn't accept packages above 200 megabytes.”
    YouTube
    Unverified1 source· Talk
  • feature
    dynamic dependencies: A plus version can resolve to the highest version available
    A plus version can resolve to the highest version available
    “plus means 'get the highest version you can find anywhere.'”
    YouTube
    Unverified1 source· Talk
  • metric
    React Native: Patch releases down to version 0.63 covered 99 percent of the market share at the time
    “We released down to 0.63, which covered 99% of the market share at the time.”
    YouTube
    Unverified1 source· Talk
  • feature
    Sonatype: Removed the problematic React Native artifacts
    Removed the problematic React Native artifacts
    “Luckily, they helped us remove those artifacts, which fully resolved the problem.”
    YouTube
    Unverified1 source· Talk
  • metric
    React Native: The last three minor versions covered 75 percent of the market share
    “By supporting those last three versions, we covered 75 percent of the market share.”
    YouTube
    Unverified1 source· Talk

Related talks