Skip to content

iOS Sound.startRecorder(...) returns "Error: Timeouted: Promise<String> was destroyed!" #730

@r-smolonskij

Description

@r-smolonskij

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

I have onStartRecord function which I use to record audio message.
On Android it always works and I don't have any issues.
On iOS simulator it also works, but sometimes( appr. every 4th attempt) it does not and my catch gives me error - "Error: Timeouted: Promise was destroyed!"

export const onStartRecord = async (onErrorHandle: () => void) => {
  const audioSet: AudioSet = {
    // Android-specific settings
    AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
    AudioSourceAndroid: AudioSourceAndroidType.MIC,
    // Common settings automatically applied to the appropriate platform
    AudioSamplingRate: 44100,
    AudioEncodingBitRate: 128000,
    AudioChannels: 1,
  };
  try {
    await Sound.startRecorder(undefined, audioSet, true);
  } catch (e) {
    console.error('onStartRecord error:', e);
    onErrorHandle();
  }
};

Can anyone here could help me understand what could be reason for that? 🙏

Library version

0.2.8

Project type

React Native (bare workflow)

React Native version

0.81.4

Expo SDK version (if applicable)

"expo": "54.0.12"

Environment info

System:
  OS: macOS 15.3
  CPU: (12) arm64 Apple M2 Pro
  Memory: 304.73 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.4
    path: /Users/computer/.nvm/versions/node/v20.19.4/bin/node
  Yarn:
    version: 1.22.22
    path: /Users/computer/.nvm/versions/node/v20.17.0/bin/yarn
  npm:
    version: 10.8.2
    path: /Users/computer/.nvm/versions/node/v20.19.4/bin/npm
  Watchman:
    version: 2025.04.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.25410.109.2511.13665796
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /usr/bin/javac
  Ruby:
    version: 3.1.7
    path: /opt/homebrew/opt/ruby@3.1/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.2
    wanted: 20.0.2
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.4
    wanted: 0.81.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions