Amplitude Logger [Error]: Invalid id length for user_id or device_id

  • 22 November 2022
  • 2 replies

I'm getting this error when using from @amplitude/analytics-react-native

In Android is work and it appears on the my amplitude dashboard, but on iOS it doesn't work.

I try in my Development Environment, this picture only show from android only


Here’s my code when user login:

  initializeAmplitude = async () => {
    const event = new Identify()
    event.set('properties', this.props.userAccountInformation.members)
    event.set('platform', Platform.OS)
    track('Auth Middleware')
    track('App Version', { version: Application.nativeApplicationVersion })
    return true

Best answer by Yuanyuan Zhang 22 November 2022, 15:25

View original

2 replies

Userlevel 4
Badge +5

Hi @imanuelvic,

Thank you for sharing the post! 

I understand you are instrumenting the React Active SDK following this doc, correct? To prevent instrumentation issues, device IDs and user IDs must be strings with a length of 5 characters or more. If an event contains a device ID or user ID that's too short, the ID value is removed from the event. But you can choose to override the default minimum length of 5 character by passing the min_id_length option with the request. Please kindly refer to this post for more discussion on this topic: 

I hope this helps!

@Yuanyuan Zhang thanks a lot!

init(AMPLITUDE_API_KEY,, { minIdLength: 1 })
this code solve my problem