Skip to content

fix: surface native errors from GetCurrentOfferingForPlacement - #1019

Merged
vegaro merged 1 commit into
mainfrom
cesar/fix-placement-offering-error
Aug 6, 2026
Merged

fix: surface native errors from GetCurrentOfferingForPlacement#1019
vegaro merged 1 commit into
mainfrom
cesar/fix-placement-offering-error

Conversation

@vegaro

@vegaro vegaro commented Jul 28, 2026

Copy link
Copy Markdown
Member

What changed

GetCurrentOfferingForPlacement could never report a failure. Both native wrappers send only an error key when the offerings fetch fails — there is no offering key in that payload — but _getCurrentOfferingForPlacement tested for a missing offering first and returned early with callback(null, null). The error was dropped, so a network failure looked exactly like "no offering is configured for this placement".

Moving the error check ahead of the missing-offering guard fixes it.

Base branch

Stacked on cesar/unity-callback-response-tests (#1012), which adds the test file this builds on.


Note

Medium Risk
Changes callback semantics for placement offerings on the Unity bridge; apps that relied on (null, null) for failures may need to handle Error, but the fix aligns behavior with other offerings APIs and is covered by tests.

Overview
GetCurrentOfferingForPlacement now forwards native failures to the app callback instead of treating them like an empty placement.

In _getCurrentOfferingForPlacement, ResponseHasError runs before the missing-offering guard. On failure, iOS/Android only send an error key (no offering), so the old order always invoked callback(null, null) and hid network and other errors.

The edit-mode test GetCurrentOfferingForPlacementDeliversNativeError now expects a populated Error (e.g. code 10, NETWORK_ERROR) instead of documenting dropped errors.

Reviewed by Cursor Bugbot for commit c72bdc7. Bugbot is set up for automated code reviews on this repo. Configure here.

@vegaro vegaro added the pr:fix A bug fix label Aug 6, 2026
@vegaro
vegaro force-pushed the cesar/fix-placement-offering-error branch from de08f83 to 4e9e038 Compare August 6, 2026 11:07
@vegaro
vegaro marked this pull request as ready for review August 6, 2026 11:24
@vegaro
vegaro requested a review from a team as a code owner August 6, 2026 11:24

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

@vegaro
vegaro force-pushed the cesar/fix-placement-offering-error branch from 4e9e038 to cabf3f1 Compare August 6, 2026 12:49
Base automatically changed from cesar/unity-callback-response-tests to main August 6, 2026 13:40
Both native wrappers send only an "error" key when the offerings fetch fails —
there is no "offering" key in that payload. The receiver tested for a missing
"offering" before checking for an error, so it returned early with
callback(null, null) and the error never reached the caller. A network failure
was indistinguishable from "no offering is configured for this placement".

Checking for the error first fixes that. The no-offering case is unchanged: both
wrappers send "{}" there, which still falls through to callback(null, null).

Co-Authored-By: Claude <noreply@anthropic.com>
@vegaro
vegaro force-pushed the cesar/fix-placement-offering-error branch from cabf3f1 to c72bdc7 Compare August 6, 2026 13:40
@vegaro
vegaro merged commit b41d3d2 into main Aug 6, 2026
17 checks passed
@vegaro
vegaro deleted the cesar/fix-placement-offering-error branch August 6, 2026 14:00
RCGitBot added a commit that referenced this pull request Aug 13, 2026
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* feat(ads): expose reward verification primitives (#971) via Peter
Porfy (@peterporfy)
### 🐞 Bugfixes
* Stop sending the purchase response twice on iOS errors (#1042) via
Cesar de la Vega (@vegaro)
* fix: surface native errors from GetCurrentOfferingForPlacement (#1019)
via Cesar de la Vega (@vegaro)
### 📦 Dependency Updates
* [AUTOMATIC BUMP] Updates purchases-hybrid-common to 18.30.0 (#1046)
via RevenueCat Git Bot (@RCGitBot)
* [Android
10.16.1](https://github.com/RevenueCat/purchases-android/releases/tag/10.16.1)
* [iOS
5.83.1](https://github.com/RevenueCat/purchases-ios/releases/tag/5.83.1)

### 🔄 Other Changes
* feat(ads): ad reward sample app (#1045) via Peter Porfy (@peterporfy)
* test: cover custom paywall tracking, ad tracker, and model parsing
(#1013) via Cesar de la Vega (@vegaro)
* test: cover missing Purchases functions (#1012) via Cesar de la Vega
(@vegaro)
* Bump fastlane-plugin-revenuecat_internal from `b4e1e7f` to `7fbbe66`
(#1040) via dependabot[bot] (@dependabot[bot])
* Bump fastlane-plugin-revenuecat_internal from `dd577ee` to `b4e1e7f`
(#1038) via dependabot[bot] (@dependabot[bot])
* Bump fastlane-plugin-revenuecat_internal from `3421c88` to `dd577ee`
(#1036) via dependabot[bot] (@dependabot[bot])
* Bump danger from 9.6.0 to 9.6.1 (#1035) via dependabot[bot]
(@dependabot[bot])

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches iOS purchase callback behavior and offerings/placement error
paths, plus new ads reward-verification APIs backed by a native SDK
bump.
> 
> **Overview**
> This **automatic release** cuts **9.8.0** by bumping package/plugin
versions (`.version`, `package.json`, Android/iOS `PLUGIN_VERSION`) and
publishing **CHANGELOG** / **VERSIONS.md** for **purchases-hybrid-common
18.30.0** (iOS **5.83.1**, Android **10.16.1**).
> 
> Shipped in this version (from prior merges, summarized in the
changelog): **ad reward verification** primitives
(`generateRewardVerificationToken` / `pollRewardVerification` on the
native bridge), fixes so **iOS purchase errors** no longer emit the
purchase callback twice, and **GetCurrentOfferingForPlacement** now
surfaces native failures instead of swallowing them.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a2f2846. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants