From 91c7da5d274dcb41803045ad24e1102b6ad63591 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 15 Nov 2025 22:49:19 +0000 Subject: [PATCH 1/2] fix: resolve var hoisting bug in console bridge causing errors to be hidden The console bridge had a critical bug where the 'seen' Set was used in the JSON.stringify replacer function before it was declared. Due to JavaScript var hoisting, 'seen' was undefined when accessed, causing TypeError that were caught and swallowed, hiding actual errors from the frame code. This fix moves the 'seen' declaration to before the try block where it's used, ensuring it's properly initialized. This will allow actual errors from attestation verification and other frame operations to be properly logged and visible for debugging. Impact: This bug was hiding 'Load failed' and other critical errors in WKWebView environments, making it impossible to diagnose attestation verification failures. Co-Authored-By: austin@paella.dev --- packages/client/rn-window/src/rn-webview/RNWebView.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/client/rn-window/src/rn-webview/RNWebView.tsx b/packages/client/rn-window/src/rn-webview/RNWebView.tsx index 1de899add..d39db36c6 100644 --- a/packages/client/rn-window/src/rn-webview/RNWebView.tsx +++ b/packages/client/rn-window/src/rn-webview/RNWebView.tsx @@ -32,6 +32,7 @@ const INJECTED_BRIDGE_JS = ` return '[Function]'; } if (typeof arg === 'object' && arg !== null) { + const seen = new Set(); // Declare before use to avoid hoisting issues try { // Use a replacer function to handle potential circular references return JSON.stringify(arg, (key, value) => { @@ -45,14 +46,10 @@ const INJECTED_BRIDGE_JS = ` }, 2); // Optional: pretty print JSON } catch (e) { return '[Unserializable Object]'; - } finally { - // Clean up seen set after stringifying each top-level argument - var seen = new Set(); // Use var for function scope before ES6 modules } } return String(arg); // Convert primitive types to string directly }); - var seen = new Set(); // Declare seen here for the final stringify const message = JSON.stringify({ type: 'console.' + type, data: serializedArgs }); if (window.ReactNativeWebView && typeof window.ReactNativeWebView.postMessage === 'function') { window.ReactNativeWebView.postMessage(message); From e0946dc8426ae5fc977ff6c5d9e13e6bfbc16bef Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 15 Nov 2025 22:53:06 +0000 Subject: [PATCH 2/2] chore: add changeset for console bridge fix Co-Authored-By: austin@paella.dev --- .changeset/four-olives-glow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/four-olives-glow.md diff --git a/.changeset/four-olives-glow.md b/.changeset/four-olives-glow.md new file mode 100644 index 000000000..1a372c3eb --- /dev/null +++ b/.changeset/four-olives-glow.md @@ -0,0 +1,5 @@ +--- +"@crossmint/client-sdk-rn-window": patch +--- + +Fix var hoisting bug in console bridge that was hiding errors from frame code