Skip to main content

I realize the new React-Native SDK is in beta, but could you please sanity-check it before releasing a new version?

We have one app running on 0.2.3 that works fine. We tried adding it to another app and got 0.3.0 which doesn’t work at all, and then tried 0.3.1 which doesn’t work, either. Rolling back to 0.2.3 got us going again, but doesn’t leave us with a lot of faith in your beta process. You’ve got too many regression problems going on right now.

Hello @Iain_Mindsea Sorry to hear that you are experiencing issues with the React-Native SDK as more releases are being made.

Could you please share screenshots or errors that you encountered when using the newer versions, please? For example, you mention, “We tried adding it to another app and got 0.3.0 which doesn’t work at all”, what do you mean by this? What errors are you experiencing? What does your stack look like?

Hope to hear from you soon!


We’re not seeing any errors or warnings at all, just no events showing up on the Amplitude dashboard. That’s what I mean by ‘not working at all’. Downgrading to 0.2.3 fixes this.

node v14.20.2

react-native-cli: 2.0.1

react-native: 0.65.1

Since the API calls don’t return values or throw exceptions I can’t tell if they’re working or not, but nothing is showing up in the console.
 


And another strange thing: we’re seeing events reported as “platform: web”, even though we don’t have any web analytics. The events are coming from iOS devices, Android devices, or simulators.

 


Hi @Iain_Mindsea I am looking into the issue. Can you please try the following to help debug?

  1. Are you waiting for `init` to finish before continuing? e.g. `await amplitude.init(...).promise` this will ensure the library is properly configured. https://github.com/amplitude/Amplitude-TypeScript/blob/main/examples/react-native/app/App.tsx#L14-L16
  2. Can you please await the result of the track calls and share the output? e.g. `const result = await track(‘My Event’).promise`

Thanks!


I’ve converted the init to async and the track to async, and set the log level to verbose, but I still don’t see any events in Amplitude, and I’m not seeing any Amplitude logging in the console. Where should the logging messages appear?


Thanks @Iain_Mindsea

  1. You can add a console logger like this:
    https://github.com/amplitude/Amplitude-TypeScript/blob/main/packages/analytics-browser/test/config.test.ts#L28-L43
    const logger = new Logger();
    logger.logLevel(LogLevel.Verbose);

    amplitude.init('api-key', undefined, {
    loggerProvider: logger,
    })
  1. To see the response output you will need to log it manually 
    const jsons = (obj) => JSON.stringify(obj, undefined, 2);
    const result = await track('My Event').promise;
    console.log(jsons(result))

 

Hopefully that will provide the details we need. Thank you. 


This is my init function:

export const amplitudeInit = async () => {
try {
await init(AMPLITUDE_API_KEY, 'example_user_id', {
logLevel: LogLevel.Verbose,
}).promise;
} catch (err) {
console.log('Error initializing Amplitude ' + err);
}
};

And this appears in the console:
 

 LOG  Error initializing Amplitude TypeError: undefined is not an object (evaluating 'window.location.search')

 


I just updated to beta 0.3.2, that was released 19 hours ago, and everything is working again. As I said earlier, it would be nice if you could test these releases a little more throughly before making them available.


Reply