AdaptySDK-React-Native: JSON Parse error: Unexpected token: P

Context:

  • version: 2.3.0
  • react-native version: 0.70.6
  • android 13
  • Kernel Version | 5.10.81-android12-9-25490797-abS908USQS2BWA2

After upgrading to latest version, I got this issue from Sentry, but I don’t know how to fix:

node_modules/react-native-adapty/lib/dist/internal/bridgeError.js in BridgeError at line 10:40

var error_1 = require("../types/error");
var BridgeError = /** @class */ (function (_super) {
    tslib_1.__extends(BridgeError, _super);
    function BridgeError(data) {
        var _this = this;
        var errNative = JSON.parse(data['message']);
        var adaptyCode = errNative['adapty_code'];
        var detail = errNative['detail'];
        var message = errNative['message'];
        _this = _super.call(this, message || detail || adaptyCode) || this;
        _this.adaptyCode = adaptyCode;

it threw the issue here:

var errNative = JSON.parse(data['message']);

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 24

Commits related to this issue

Most upvoted comments

Hi everyone, I am having the same issue on Android: SyntaxError: Unexpected token C in JSON at position 0 at JSON.parse (<anonymous>) at new BridgeError

I am running in an emulator, have Play Market installed, logged in with proper testing account, npm package v. 2.3.6

JSON Parse Error is the one that is thrown from JS’s JSON.parse. I thought I’ve handled all of these in v2.3.4. Going to browse all the code today.