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
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.
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

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?)
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
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.
I manually called the url with proper app id and it worked. maybe some wrong with the sdk
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
Or just provide another storage namespace before init
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?
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
thanks for your help
Hi, we have the same problem. After some time we see that we get 400 only from the same browser we logged in to countly portal. It may be same for you.
Please sign in to leave a comment.