I build UMDIA, an iPhone app for learning European Portuguese. It's React and Vite wrapped in Capacitor, with Firebase behind it. The web-to-native setup has been good to me, but it has a few traps that don't show up in the browser. These three made it into App Store builds before I caught them.
1. A Capacitor plugin returned from a promise calls .then on the native side
App Check never worked in version 1.0. No crash and no visible error: the token request just never happened. The cause was this pattern:
async function loadAppCheck ( ) { const { FirebaseAppCheck } = await import ( '@capacitor-firebase/app-check' ) await FirebaseAppCheck . initialize ( options ) return FirebaseAppCheck // the bug }
Enter fullscreen mode
Exit fullscreen mode
A Capacitor plugin is a Proxy . Any property you read on it becomes a call to a native method. When an async function returns a value, JavaScript checks whether that value is a thenable by reading .then .…