Release build crashes with ‘unknown module’ error when using createNativeStackNavigator from @amazon-devices/react-native-screens
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
- Pick either the emulator or device to test with
- Launch the Debug build (works fine)
- 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:
- 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.
- 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.
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 ![]()
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)