react-native-purchases: [Expo go] Invariant Violation: `new NativeEventEmitter()` requires a non-null argument.

  1. Environment
    1. Platform: IOS
    2. SDK version: EXPO 45
    3. React Native version: 0.68.2

CPU Apple M1 Max

Describe the bug hello, I wanted to use RevenueCat to simplify payments, but I am blocked under ios with error, I am under Expo 45 does anyone have a solution?

Invariant Violation: new NativeEventEmitter() requires a non-null argument.

  const initPaymments = async () => {
    Purchases.setDebugLogsEnabled(true);
  

    if (Platform.OS === "ios") {
      await Purchases.setup(REVENUECAT_SDK_KEY_IOS);
    } else if (Platform.OS === "android") {
      await Purchases.setup(REVENUECAT_SDK_KEY_ANDROID);
    }
  };

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29 (13 by maintainers)

Most upvoted comments

Thanks a lot for deep diving into this, really appreciated.

Just to clarify some point though, the blog post you mentioned also using expo start --dev-client to start the application (I think you also started in this way), which is also working in my setup. The problem is in my case using Expo Go and running the application in there, which throws this error.

Actually, it would not be possible to test anything for in-app purchases in Expo Go because that is a separate application and we won’t be able to add products to corresponding Apple account or use sandbox. But it would be nice to not get an error as it is really useful for testing other parts of the business logic (considering just calling configure throws this error).

Anyway, I think I am fine as this is not blocking me and only causing small inconvenience during development.

Ok, that’s a bummer. I know this doesn’t help you at the moment, but I’m going to chat with the team and see what we can do. We’ll get back to ya.

@kozarip thanks for reporting back!! I’m glad it’s working 🙌

@kozarip for Expo, you will have to make Development builds in order for the SDK to work.

This is documented here: https://www.revenuecat.com/docs/reactnative#option-2-using-expo

The easiest way to get it done is by doing a development build running one of the following:

npx expo run:android -d
npx expo run:ios -d

@vbylen thanks for reporting back! I’m glad it’s working now. Have a great day!

Hey, I am observing the same error in my managed expo workflow. It happens when calling Purchases.setupor Purchases.configure methods. Just to note, I am trying to start application using the expo start and using Expo Go.

All I am doing is installing react-native-purchaseswith expo install react-native-purchases and calling the above configuration method.

Environment

  • Platform: IOS
  • SDK version: I tried different versions of react-native-purchases from latest 5.0.0 beta 1 to 4.5.2, got the exact same error.
  • React Native version: 0.68.2
  • Expo version: 45.0.0