Skip to content

Commit b708ee9

Browse files
RSNarafacebook-github-bot
authored andcommitted
Log if bridgeless mode is enabled, when JS Module call fails
Summary: Log whether bridgeless mode is enabled or not when calling into a JavaScript module method fails. We are seeing a surge of these crashes in MessageQueue.js bridgeless mode. This temporary log will help us drill down into the issue. Changelog: [Internal] Created from CodeHub with https://fburl.com/edit-in-codehub This should not mess with the sitevar overrides. These are the two diffs where we mapped the venice and bridge errors to the same mid: D36649249, D36649249. Reviewed By: fkgozali Differential Revision: D37898744 fbshipit-source-id: 0ab337c8c0d73bd70c4756a16b8ece8ba8730c47
1 parent 6179233 commit b708ee9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Libraries/BatchedBridge/MessageQueue.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,12 @@ class MessageQueue {
408408
const callableModuleNames = Object.keys(this._lazyCallableModules);
409409
const n = callableModuleNames.length;
410410
const callableModuleNameList = callableModuleNames.join(', ');
411+
412+
// TODO(T122225939): Remove after investigation: Why are we getting to this line in bridgeless mode?
413+
const isBridgelessMode = global.RN$Bridgeless === true ? 'true' : 'false';
411414
invariant(
412415
false,
413-
`Failed to call into JavaScript module method ${module}.${method}(). Module has not been registered as callable. Registered callable JavaScript modules (n = ${n}): ${callableModuleNameList}.
416+
`Failed to call into JavaScript module method ${module}.${method}(). Module has not been registered as callable. Bridgeless Mode: ${isBridgelessMode}. Registered callable JavaScript modules (n = ${n}): ${callableModuleNameList}.
414417
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.`,
415418
);
416419
}

Libraries/BatchedBridge/__tests__/MessageQueue-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe('MessageQueue', function () {
108108
const unknownModule = 'UnknownModule',
109109
unknownMethod = 'UnknownMethod';
110110
expect(() => queue.__callFunction(unknownModule, unknownMethod)).toThrow(
111-
`Failed to call into JavaScript module method ${unknownModule}.${unknownMethod}(). Module has not been registered as callable. Registered callable JavaScript modules (n = 1): MessageQueueTestModule.
111+
`Failed to call into JavaScript module method ${unknownModule}.${unknownMethod}(). Module has not been registered as callable. Bridgeless Mode: false. Registered callable JavaScript modules (n = 1): MessageQueueTestModule.
112112
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.`,
113113
);
114114
});

0 commit comments

Comments
 (0)