amplitude / Amplitude-ReactNative

Official Amplitude React Native SDK
MIT License
80 stars 20 forks source link

Events not logged #92

Open punndcoder28 opened 3 years ago

punndcoder28 commented 3 years ago

I am facing an issue in one of our projects in my workplace where we have created 2 projects on Amplitude one of which is used for production usage and another for development/testing usage. The events that are being sent from development/testing environment are recorded in the production project on amplitude which should ideally not happen due to different API keys for each environment. We have followed the steps illustrated for installation and usage from the docs

SDK Version @amplitude/react-native: 2.3.3

Things tried till now

Edit 1: Dug deeper to check what the exact issue is. We have the amplitude API key defined in an config file from which the right key is fetched depending on the environment in the reducer file. The event from development/test is recorded in the production project on amplitude when environments are switched. Amplitude is not able to differentiate between the two API keys. Is this the expected behaviour?

haoliu-amp commented 3 years ago

I think it should be more a issue from your side. We should fetch whatever the key provided by the user.

msulaiman119 commented 2 years ago

I am facing same issue. I am integrating with React native. I followed the docs and i did all the steps. But the events are not showing in the log section. I tried to execute the promise and its giving me true in return but still no events are visible inside log section

Any solution?

punndcoder28 commented 1 year ago

Hi @haoliu-amp . My sincere apologies for a late reply. Coming back to the issue, we have two projects that our application uses (prod and dev with their own unique api keys). We also have the following code that fetches the proper api key (can confirm this after logging the keys fetched) to initialize the instance and send our events

Amplitude.getInstance().init(Config.amplitude_key);
Amplitude.getInstance().logEvent(name, properties);

But since we start off in prod, even though we change to our dev env the events are not sent to the dev project but are sent to the prod project. I have checked if we are retrieving the right key and we are. I hope this makes a better sense