BranchMetrics / web-branch-deep-linking-attribution

The Branch Web SDK for deep linking and attribution. Once initialized, the Branch Web SDK allows you to create and share links with a banner (web only), over SMS, or your own methods by generating deep links. It also offers event tracking, access to referrals, and management of credits.
https://help.branch.io/developers-hub/docs/web-sdk-overview
MIT License
287 stars 101 forks source link

Uncaught TypeError: Cannot use 'in' operator to search for 'String' in undefined #675

Open itslenny opened 4 years ago

itslenny commented 4 years ago

When loading the branch-sdk npm package I get this error

build.min.js:formatted:1 Uncaught TypeError: Cannot use 'in' operator to search for 'String' in undefined
    at ca (build.min.js:formatted:1)
    at build.min.js:formatted:1
    at Object../node_modules/branch-sdk/dist/build.min.js (build.min.js:formatted:1)

which traces to this line in the branch sdk f in c || (c[f] = {});.

(function() {
    var aa = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {
        if (c.get || c.set)
            throw new TypeError("ES3 does not support getters and setters.");
        a != Array.prototype && a != Object.prototype && (a[b] = c.value)
    }
      , ba = "undefined" != typeof window && window === this ? this : "undefined" != typeof global && null != global ? global : this;
    function ca(a, b) {
        if (b) {
            for (var c = ba, d = a.split("."), e = 0; e < d.length - 1; e++) {
                var f = d[e];
                f in c || (c[f] = {});
                c = c[f]
            }
            d = d[d.length - 1];
            e = c[d];
            f = b(e);
            f != e && null != f && aa(c, d, {
                configurable: !0,
                writable: !0,
                value: f
            })
        }
    }
//...

Even if I don't "use" the branch sdk I get this error. Just by importing it this error fires.

Screen Shot 2020-02-09 at 2 31 25 PM Screen Shot 2020-02-09 at 2 30 44 PM
Almo7aya commented 3 years ago

@itslenny Did you fix this?

andyleeboo commented 2 years ago

having the same issue

build.min.js:3 Uncaught TypeError: Cannot use 'in' operator to search for 'String' in undefined
    at da (build.min.js:3)
    at build.min.js:3
    at Object../node_modules/branch-sdk/dist/build.min.js (build.min.js:174)
    at __webpack_require__ (bootstrap:79)
    at Module../src/shared/core/services/events/branch.service.ts (direct-transaction.service.ts:10)
    at __webpack_require__ (bootstrap:79)
    at Module../src/app/services/event.service.ts (currency.service.ts:16)
    at __webpack_require__ (bootstrap:79)
    at Module../src/app/onboarding/run-onboarding/run-onboarding.component.ts (main.js:32730)
    at __webpack_require__ (bootstrap:79)
svitlana-vasilchenko commented 2 years ago

In order to fix it you should call branch.init() in component loading in your route, not in parent, just on page where you need branchIo.

jaslioin commented 2 years ago

temporary solution:

edit the minified bundle build.min.js image

      , ca = "undefined" != typeof window && window === this ? this : "undefined" != typeof global && null != global ? global : window;
    //   , ca = "undefined" != typeof window && window === this ? this : "undefined" != typeof global && null != global ? global : this;

it just work and i dont know why they didnt fix it for so long

yonkahlon commented 2 years ago

@jaslioin Thanks so much! That worked :-)

Any chance for an official release?

andrewatwood commented 2 years ago

@jwangler-branch with a recent release, I'd have assumed this was fixed. But alas! It's still an issue!