Answered

Problem integrating web sdk

i have a website built in react and i wanna add web sdk to it. i have countly community edition deployed and i am using it's ip to connect to my application but when i run my app. countly sdk throws 400 exception with message. App does not exist. i am pretty sure that i have added the correct app key. The same application is working correct on react native

0

Comments

9 comments
  • Hello,
    recheck the app_key in the request that fails. Maybe it was some leftover from another app_key/website you used on the same domain? Because they share local storage, etc.

    0
    Comment actions Permalink
  • I checked app key and it is correct. also i cleared local storage but still didn't work. i am on localhost right now.

    Here is my code
    countly

    0
    Comment actions Permalink
  • Clearing local storage would not help, in most cases SDK recovers it and prevents outside manipulations

    But if url of the request contained correct app_key, then I guess something on server side preventing it from verifying app. Does server work correctly and has connection to correct DB for api process (not dashboard process?)

    0
    Comment actions Permalink
  • i didn't did anything on the server. i just setup the one click droplet from digitalocean. i never logged in to server console. same server and same application is working correct on react native

    0
    Comment actions Permalink
  • i saw the url that was used by countly and i saw this.

    app_key=YOUR_APP_KEY

    for some reason countly is not sending proper app key

    however i am setting it properly like this.

    countly

    I manually called the url with proper app id and it worked. maybe some wrong with the sdk

    0
    Comment actions Permalink
  • Ok, then yes, it was initialized with incorrect app_key some time before and just has it in the storage.
    You can clear the storage by calling

    Countly._internals.clearQueue()
    

    Or just provide another storage namespace before init

    Countly.namespace = "test_";
    
    0
    Comment actions Permalink
  • thanks, first method didn't work but changing the namespace fixed the issue.

    I saw that when i added app_key in web app of the project that was set for mobile device. it didn't register my device in the devices section. should i create two projects one for mobile and one for web?

    0
    Comment actions Permalink
  • Yes, so for web most data is received from user agent on server.
    and I think currently mobile app types do not process that data, only web type apps do.
    So changing to web type or separate app would work best

    0
    Comment actions Permalink
  • thanks for your help

    0
    Comment actions Permalink

Please sign in to leave a comment.