Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get the active entitlements in Sandbox environment when having same type of entitlements in Prod. #3590

Open
9 of 12 tasks
menghaozhang opened this issue Jan 22, 2024 · 3 comments
Assignees
Labels

Comments

@menghaozhang
Copy link

menghaozhang commented Jan 22, 2024

Describe the bug
The user data in prod environment will override the sandbox environment for active entitlements. I have same entitlements type(not exactly same as different expire dates.) in both prod and sandbox env when using customerInfo?.entitlements.activeInAnyEnvironment I can only get the prod env active entitlements. Which is fine. But when using customerInfo?.entitlements.activeInCurrentEnvironment I get no active entitlements no, as empty.

  1. Environment
    1. Platform: iOS
    2. SDK version: 4.32.0
    3. StoreKit version:
      • StoreKit 1
      • StoreKit 2 (enabled with usesStoreKit2IfAvailable(true))
    4. OS version: 17.0
    5. Xcode version: 15.x
    6. Device and/or simulator:
      • Device
      • Simulator
    7. Environment:
      • Sandbox
      • TestFight
      • Production
    8. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue. Complete logs with Purchases.logLevel = .verbose will help us debug this issue.
Logs here
  1. Steps to reproduce, with a description of expected vs. actual behavior
  • Create a user with same type of active entitlement in both prod and sandbox env.
  • Use customerInfo?.entitlements.activeInCurrentEnvironment to fetch the data.

Expected behavior

  • Client should get expected data same as shown in console in corresponding environment.

Actual behavior

  • In sandbox env, the result is empty.
  • In prod env, the result is correct.
  1. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
    If I "remove" the active entitlement from prod env user(either transfer to another user or delete it), I can get correct active entitlement in sandbox env.

  2. Additional context

@RCGitBot
Copy link
Contributor

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

@menghaozhang menghaozhang changed the title Prod environment will override the Sandbox environment when getting the active entitlements. Cannot get the active entitlements in Sandbox environment when having same type of entitlements in Prod. Jan 22, 2024
@aboedo
Copy link
Member

aboedo commented Jan 24, 2024

@menghaozhang thanks for reporting! You're correct. The underlying issue stems from the fact that our backend sends only one product per entitlement, so if you have an entitlement from both sandbox and production, this situation can happen.
We'll take a look at possible fixes for this.

@aboedo aboedo self-assigned this Jan 24, 2024
@menghaozhang
Copy link
Author

I see, thank you @aboedo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants