Leanplum / Leanplum-JavaScript-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.

Home Page:https://www.leanplum.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: navigator is not defined

albert-olive opened this issue · comments

Hi,

We're starting to use leanplum on our project and we're having this error. We're using SSR.

web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:8526)

We have tried to initialize on client but with no luck.

Thanks

What's the exact error?

Yes, sorry about that.

Here's it:

ReferenceError: navigator is not defined at Object.<anonymous> (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:8526) at c (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:8115) at Object.<anonymous> (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:8144) at b (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:320) at a.__esModule.default (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:15345) at Object.<anonymous> (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:15439) at b (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:320) at e (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:703) at /Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:712 at c.(anonymous function).i (/Users/albert.olive/Repos/web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:81)

Are you running it in a non-browser environment? (e.g. nodejs)

Hi, we're using React with server side rendering so yes, we're using nodejs with express.

Thanks

Hey @albert-olive, at this time the Leanplum Javascript SDK is for use in the browser only. It will not load in a nodejs server environment. It requires the navigator element of the browser to run. If you would like additional support integrating Leanplum, please feel free to contact support@leanplum.com for assistance!

Ok thanks, I'll close the issue then.