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

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

Open
itslenny opened this issue Feb 9, 2020 · 6 comments

Comments

@itslenny
Copy link

itslenny commented Feb 9, 2020

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
Copy link

Almo7aya commented Jan 4, 2021

@itslenny Did you fix this?

@andyleeboo
Copy link

andyleeboo commented Sep 16, 2021

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
Copy link

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
Copy link

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
Copy link

@jaslioin Thanks so much! That worked :-)

Any chance for an official release?

@andrewatwood
Copy link

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

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

No branches or pull requests

7 participants