RevenueCat / react-native-purchases

React Native in-app purchases and subscriptions made easy. Support for iOS and Android.
https://www.revenuecat.com
MIT License
778 stars 84 forks source link

v8.0.0 - RNPurchases setupPurchases was called with 8 arguments but expects 9 arguments. #1056

Closed GLSinthu closed 3 months ago

GLSinthu commented 3 months ago

Updated to the latest version.

  1. Environment
    1. Platform:iOS
    2. SDK version:8.0.0
    3. OS version:17.0
    4. Xcode/Android Studio version:15
    5. React Native version:71.14

Additional context Add any other context about the problem here. simulator_screenshot_71EC72C7-4F36-46B2-A926-481435C40EC7

RCGitBot commented 3 months ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

bilal1031 commented 3 months ago

I am facing this exact issue on iOS. It is happening when I call Purchases.configure({apiKey: });

MarkVillacampa commented 3 months ago

Hello @GLSinthu @bilal1031

Thanks for reporting this issue. Could you tell us more about what you did to update the library right before the error occurred?

This issue could present itself if the native side of the library is not in sync with the javascript side. We recommend to always run pod install and recompile the app after updating the npm package.

If you are working across different git branches of your app, where some branches are using version 7 of the SDK whereas others are using version 8. you'll need to make sure you run pod install every time you switch branches to ensure the javascript and the native side of the library remain in sync.

Just for context: version 8 of the library introduces a new parameter to the native configure function that the javascript function passes in. The reason you're seeing this error could be the javascript side has not been updated but the native one was.

bilal1031 commented 3 months ago

@MarkVillacampa, Yes you are correct, version 8.0.0 fixes this issue.

GLSinthu commented 3 months ago

@MarkVillacampa pod native side is in sync, the following is from podfile.lock

  - RNPurchases (8.0.0):
    - PurchasesHybridCommon (= 13.0.0)

Initializing like so:

      await Purchases.configure({
        apiKey,
        appUserID,
      });

Other than the required In-App Purchase Key, there was no other configuration in the documentation.

MarkVillacampa commented 3 months ago

Is the Javascript part using v8 of the SDK as well?

The exact error you experienced can happen if you're using v8 on the native side (as you seem to be doing based on the podfile.lock) but v7 on the Javascript side.

GLSinthu commented 3 months ago

This following is from our yarn.lock file:

react-native-purchases@^8.0.0:
  version "8.0.0"
  resolved "https://registry.yarnpkg.com/react-native-purchases/-/react-native-purchases-8.0.0.tgz#da7c0aac33e8e6346e6b91d8ee9fd81e1ea2cd85"
  integrity sha512-GnFqVoYfiugUv0XtPVld365ixoPdM9U4EH9IKJIvJBXcwyKqJ2Uno5ubmNOlNbcAeuR8X7+1V+rQVbAReGdwDA==
  dependencies:
    "@revenuecat/purchases-typescript-internal" "13.0.0"
GLSinthu commented 3 months ago

You were right @MarkVillacampa, my bundler on was not updating after installing the new version. Marking as closed.

gabeh91 commented 3 months ago

I'm also seeing this issue, but for android only. Currently using package v8.0.0, crashes seem to happen before reaching the metro bundler, so it doesn't seem to be because of a JS/native mis-match.

Screenshot 2024-08-07 at 12 56 40 PM

I have cleared cradle cache and synched the gradle project in android studio. I have re-installed all yarn packages, restarted the metro bundler and cleared the cache, but still getting native android crash.