Skip to content

TypeError: Cannot read property 'BEFORE' of undefined #1140

Open
@ftr9

Description

@ftr9

I followed the official installation instructions for the Amplitude React Native SDK in my Expo app

📄 Docs: Amplitude React Native SDK

Expected Behavior

The SDK should initialize correctly and allow event tracking.

ℹ️ Note: I’m not using Expo Go. The app runs in a development build.

What I implemented:

1. Initialization

Initialization Code

2. Event Tracking

Event Tracking

Current Behavior

The SDK throws an error trying to access a property on undefined.

Error Screenshot

Error Location
Terminal Error Log

Possible Solution

I investigated the SDK source and found that PluginType was undefined where PluginType.BEFORE was being accessed.

🔧 Fix (Temporary Workaround)

  • I commented out the existing PluginType reference.
  • Then I manually defined PluginType right where the crash occurred.
  • After this, the SDK started working, and events appeared on the Amplitude dashboard.

Before Modification

Before Modification

After Modification

After Modification

Terminal Output

Logs

Event Received in Dashboard

Amplitude Dashboard

Steps to Reproduce

  1. Follow the official Amplitude SDK installation guide.
  2. Set up the SDK in an Expo development build (not Expo Go).
  3. Run the app with the following environment:
  • React Native: 0.79.3
  • Expo SDK: 53.0.10
  • Node.js: 20.16.0
  • Eas-cli: 15.0.12

Environment

  • JS SDK Version: @amplitude/analytics-react-native:^1.4.13
  • Installation Method: npm
  • React Native: 0.79.3
  • Expo SDK: 53.0.10
  • Eas-cli: 15.0.12

Metadata

Metadata

Labels

RNReact Native SDKbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions