Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 2 months ago by CometDiscoverer417

How Can I Fix the Undefined 'match' Error When Loading Compressed GLB Assets on Android in Expo?

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

GLB Asset Loading Fails on Android with Undefined ‘match’ Error

Environment

  • Expo Version: 51.0.39
  • React Native Version: 0.74.5
  • Platform: Android
  • Reproduction Method: expo run:android

Description

When loading a compressed GLB file in a React Native Expo project, an error occurs on Android that prevents the asset from loading:

BASH
ERROR Error: Could not load http://10.0.2.2:8082/assets/?unstable_path=.%2Fassets%2Fmodels/output.glb?platform=android&hash=80c4e5d9a2989da95b359e712a6197f5: Cannot read property 'match' of undefined

Steps to Reproduce

  1. Compress a GLB file using
BASH
gltf-transform optimize input.glb output.glb --texture-compress webp
  1. Place the compressed GLB in the project’s assets folder
  2. Use the following code to load the asset:
JAVASCRIPT
const AvaPath = Asset.fromModule(require('../../assets/models/output.glb')).uri; export function Ava({ words, replay, setReplay }) { const group = React.useRef(); const { nodes, materials } = useLoader(GLTFLoader, AvaPath, (loader) => { loader.setMeshoptDecoder(MeshoptDecoder); }); }
  1. Run the project with
BASH
expo run:android

Expected Behavior

The GLB file should load successfully on Android, just as it does on web (expo start --web).

Actual Behavior

Loading fails with an undefined ‘match’ error, preventing the asset from displaying.

Debugging Steps Attempted

  • Verified the asset path
  • Confirmed that the asset loads correctly on web
  • Checked all dependencies and versions

Relevant Dependencies

  • expo-asset: 10.0.10
  • expo-file-system: 17.0.1
  • meshoptimizer: 0.22.0
  • three: 0.169.0

Potential Areas of Investigation

  1. Differences in asset loading mechanisms between web and Android
  2. Compatibility issues of compressed GLB files with the React Native asset system
  3. Potential problems with using Asset.fromModule() on Android

Additional Notes

  • The same GLB file works correctly on web
  • The file was compressed from 1GB to 20MB using gltf-transform

Reproducibility

✓ Consistently reproducible

Request

Could the maintainers please provide guidance on:

  • The proper way to load compressed GLB assets in React Native/Expo
  • Possible workarounds for this issue
  • Any known compatibility issues with GLB assets on Android

/cc @expo/expo @react-three/fiber

1

Comments 0

Answers 0

Views 72

0 Answers

Discussion

No comments yet.