Release build crashes with 'unknown module' error when using createNativeStackNavigator from @amazon-devices/react-native-screens

Release build crashes with ‘unknown module’ error when using createNativeStackNavigator from @amazon-devices/react-native-screens

:backhand_index_pointing_right: Bug Description


1. Summary

Switching from “@amzn” to “@amazon-devices” causes our app to not launch in Release mode (but Debug mode is fine)

It seems to be an issue with createNativeStackNavigator from @amazon-devices/react-native-screens/native-stack.

Backstory

We have a top level “stack navigator” for some initial screens (like a login screen) and a “drawer navigator” inside.

The drawer navigator has a “native stack navigator” for each Drawer item.

Definitions

“Back Focus”: When a user navigates back to a previous screen, the previously focused item should still be focused.

“Initial Focus”: When a user first navigates to a screen, a particular item should be focused.

(Example: User scrolls to content on the “home” screen, goes to a “details” screen, the “details” screen should have a particular button focused, pressing BACK should return the user to the “home” screen and the item that was previously focused should still be focused)

App Name: com.pbs.video (codename: kosga)
App Link on Amazon Appstore (found through Developer Console → Actions column in App List → View on Amazon.com): PBS - App on Amazon Appstore (note that we haven’t released our Vega app yet, but we have LAT builds)

Bug Severity
Select one that applies

  • Impacts operation of app
  • Blocks current development
  • Improvement suggestion
  • Issue with documentation (If selected, please share the doc link and describe the issue)
  • Other

2. Steps to Reproduce

  1. Pick either the emulator or device to test with
  2. Launch the Debug build (works fine)
  3. Launch the Release build (fails to start, see logs)

3. Observed Behavior

See section 2.

4. Expected Behavior

See section 2.

4.a Possible Root Cause & Temporary Workaround

This line seems to be causing the issue:

import { createNativeStackNavigator } from "@amazon-devices/react-native-screens/native-stack";

I have tried:

  1. Switching to non-native stack navigator:
import { createStackNavigator } from '@amazon-devices/react-navigation__stack';

This fixes the issue of the app not loading but causes many issues with “back focus” in our app and also breaks our drawer navigation UX.

  1. I have tried switching to a different native stack
import { createNativeStackNavigator } from '@amazon-devices/react-navigation__native-stack';

Which I think has the same issue – it breaks our UX.

^^^ In both scenarios, I tried changing our internal code and I can get “back focus” to work but at the cost of “initial focus”. I tried someRef.current.focus(), hasTVPreferredFocus, and TVFocusGuideView but none of these worked to get both initial focus and back focus working together.

5. Logs or crash report

prodnotstarting_emulator.log (2.3 MB)

The log file was captured like:

kepler exec vda shell journalctl -f --since now > prodnotstarting_emulator.log

Then the app was built and installed with:

react-native build-kepler --build-type Release
kepler device install-app --dir . -b Release
kepler device launch-app

Then the log capture was stopped with CTRL-C after the app failed to start.

The log file is big, here is the section that is probably relevant:

Dec 29 22:07:31.987478 amazon-3ac5a22728d8d8a9 local0.err com.pbs.video[383500]: 9969154980813873527 ERROR com.amazon.keplerscript: [KeplerScript-JavaScript] Error: Requiring unknown module "6f91054f38514f419633"., js engine: hermes
Dec 29 22:07:31.987666 amazon-3ac5a22728d8d8a9 local0.err com.pbs.video[383500]: 28 E Volta:Reporting Fatal Exception:
Dec 29 22:07:31.987694 amazon-3ac5a22728d8d8a9 local0.err com.pbs.video[383500]: 28 E Volta:Error: Requiring unknown module "6f91054f38514f419633".
                                                                                         at unknownModuleError (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:391:15)
                                                                                         at loadModuleImplementation (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:300:29)
                                                                                         at guardedLoadModule (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:240:36)
                                                                                         at metroRequire (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:127:24)
                                                                                         at anonymous (node_modules/@amzn/react-native-screens/src/native-stack/navigators/createNativeStackNavigator.tsx:102:16)
                                                                                         at loadModuleImplementation (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:342:12)
                                                                                         at guardedLoadModule (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:240:36)
                                                                                         at metroRequire (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:127:24)
                                                                                         at anonymous (node_modules/@amzn/react-native-screens/src/native-stack/index.tsx:4:1)
                                                                                         at loadModuleImplementation (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:342:12)
                                                                                         at guardedLoadModule (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:240:36)
                                                                                         at metroRequire (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:127:24)
                                                                                         at anonymous (/Users/dcstreeter/kepler/kos23/ga/build/lib/rn-bundles/Release/1c6dd587c66f65092f880fe9c353a8cba788017df9504d9052bcbd6d9f91ea63.bundle:40319:30)
                                                                                         at loadModuleImplementation (node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-runtime/src/polyfills/require.js:342:12)
                                                                                         at guardedLoadModule (node_modules/@react-native

6. Environment

Please fill out the fields related to your bug below:

  • SDK Version: 0.21.5245
  • App State: Foreground/Launching
  • OS Information

(Note: This is for the emulator, I can provide device info if needed. The results and log errors are the same either way)

NAME="OS"
OE_VERSION="4.0.0"
OS_MAJOR_VERSION="1"
OS_MINOR_VERSION="1"
RELEASE_ID="10"
OS_VERSION="1.1"
BRANCH_CODE="TV Ship"
BUILD_DESC="OS 1.1 (TV Ship/10240300)"
BUILD_FINGERPRINT="1.0.24030.0(9a1d8dfa7da5d600)/10240300N:user/dev-keys"
BUILD_VARIANT="user"
BUILD_TAGS="dev-keys"
BUILD_DATE="Thu Sep 25 10:32:58 UTC 2025"
BUILD_TIMESTAMP="1758796378"
VERSION_NUMBER="1002034030030"

7. Example Code Snippet / Screenshots / Screengrabs

See Section 4.a

I did start working on a standalone example that demonstrates this, but it is not finished.


:backhand_index_pointing_right: Additional Context


We need to switch from “@amzn” to “@amazon-devices” (because of an issue with Amazon Pay but that’s a separate issue).

Builds

The system will not allow vpkgs to be uploaded but I think they are very relevant to this issue so maybe this workaround will work :crossed_fingers:
Rename this .txt to a .zip and unzip it to find 4 vpkgs inside.
Archive.txt (40.2 MB)

Package.json

package.json (5.0 KB)

Hi @David_Streeter,

Thank you for the detailed bug report on the release build crash with the ‘unknown module’ error when using createNativeStackNavigator from @amazon-devices/react-native-screens.

Our team is investigating this issue and will provide an update as soon as we have more information.

Thanks for helping us improve the Vega platform.

Warm regards,
Aishwarya

We recieved some help from Amazon outside of this forum, so I am sharing the results now (still being verified by testers)

We had some luck switching from v7 of the navigation libraries to v2. Example:

Before

"@amazon-devices/react-navigation__drawer": "~7.0.0",
"@amazon-devices/react-navigation__stack": "~7.0.0",

After

"@amazon-devices/react-navigation__drawer": "~2.0.0",
"@amazon-devices/react-navigation__stack": "~2.0.0",

Additional

But we also had to add additional packages to get our main app to work. I’m not sure if it’s relevant to other apps but I’ll include them here:

"@amazon-devices/react-navigation__native": "~2.0.0",
"@amazon-devices/react-navigation__native-stack": "~2.0.0",
"react-native-gesture-handler": "^2.30.0",
"@amazon-devices/react-native-screens": "~2.0.0",
"@amazon-devices/react-native-safe-area-context": "~2.0.0",
"@amazon-devices/react-native-reanimated": "~2.0.0",
"@amazon-devices/react-native-gesture-handler": "~2.0.0",
"@amazon-devices/keplerscript-react-native-reanimated": "~2.0.0",

Hopefully this helps someone.

So as of right now we’re no longer blocked. We are hoping that we can eventually update to a version that works for us or for a better way for us to manage focus.