Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'attributes' of undefined, js engine: hermes: Unhandled JS Exception: TypeError: Cannot read property 'attributes' of undefined, js engine: her... #6420

Closed
sentry-io bot opened this issue Nov 28, 2023 · 8 comments · Fixed by WordPress/gutenberg#56723

Comments

@sentry-io
Copy link

sentry-io bot commented Nov 28, 2023

Sentry Issue: WORDPRESS-IOS-464F

How to reproduce it

  1. Open the app and create a post.
  2. Switch to HTML mode.
  3. Paste the following HTML code:
<div>
<p>Hello world!</p>
</div>
  1. Switch back to Visual mode.
  2. Tap two times on the Classic block to present the bottom sheet.
  3. Tap on Convert to blocks option.
  4. Observe the crash.

Symbolicated stack trace

Unhandled JS Exception: TypeError: Cannot read property 'attributes' of undefined, js engine: hermes, stack:
/workdir/gutenberg/packages/blocks/src/api/parser/get-block-attributes.js:282:getBlockAttributes
/workdir/gutenberg/packages/blocks/src/api/raw-handling/html-to-blocks.js:34:Array.from.flatMap$argument_0
/workdir/gutenberg/packages/blocks/src/api/raw-handling/html-to-blocks.js:24:htmlToBlocks
/workdir/gutenberg/packages/blocks/src/api/raw-handling/index.js:74:pieces.map$argument_0
/workdir/gutenberg/packages/blocks/src/api/raw-handling/index.js:50:rawHandler
/workdir/gutenberg/packages/block-library/src/missing/edit.native.js:255:replaceBlocks
/workdir/gutenberg/packages/data/src/components/use-dispatch/use-dispatch-with-map.js:53:<anonymous>
/workdir/gutenberg/packages/block-library/src/missing/edit.native.js:153:onPress
/workdir/gutenberg/packages/components/src/mobile/bottom-sheet/cell.native.js:179:onCellPress
/workdir/gutenberg/node_modules/react-native/Libraries/Pressability/Pressability.js:758:_performTransitionSideEffects
/workdir/gutenberg/node_modules/react-native/Libraries/Pressability/Pressability.js:695:_receiveSignal
/workdir/gutenberg/node_modules/react-native/Libraries/Pressability/Pressability.js:525:responderEventHandlers.onResponderRelease
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:22:invokeGuardedCallbackImpl
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:40:invokeGuardedCallback
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:53:invokeGuardedCallbackAndCatchFirstError
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:73:executeDispatch
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1125:executeDispatchesAndReleaseTopLevel
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:361:forEachAccumulated
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1160:batchedUpdates$argument_0
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8457:batchedUpdatesImpl
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1106:batchedUpdates
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1137:_receiveRootNodeIDEvent
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1209:ReactNativePrivateInterface.RCTEventEmitter.register$argument_0.receiveTouches
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:427:__callFunction
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:113:__guard$argument_0
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:368:__guard
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:callFunctionReturnFlushedQueue
Raw stack trace
RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'attributes' of undefined, js engine: hermes: Unhandled JS Exception: TypeError: Cannot read property 'attributes' of undefined, js engine: hermes, stack:
anonymous@1:1777652
anonymous@1:1786178
anonymous@1:1786090
anonymous@1:1832789
t@1:1832605
replaceBlocks@1:4210284
anonymous@1:1694947
onPress@1:4209376
onPress@1:2614459
value@1:439629
value@1:439201
onResponderRelease@1:438018
c@1:362991
m@1:363048
v@1:363080
w@1:363212
Le@1:367450
$@1:364719
anonymous@1:367802
Ce@1:425466
Ne@1:367370
Me@1:367643
receiveTouches@1:420353
value@1:169079
anonymous@1:167579
value@1:168525
value@1:167537

  ?, in RCTFatal
  ?, in -[RCTExceptionsManager reportFatal:stack:exceptionId:extraDataAsJSON:]
  ?, in -[RCTExceptionsManager reportException:]
  ?, in -[RCTModuleMethod invokeWithBridge:module:arguments:]
  ?, in facebook::react::invokeInner
...
(13 additional frame(s) were not displayed)
Copy link
Author

sentry-io bot commented Nov 28, 2023

Sentry issue: JETPACK-IOS-161H

@dcalhoun
Copy link
Member

@fluiddot from reviewing the stack trace and the crash's first occurrence in WP 23.6.0.1/GBM 1.107.0, this seems related to WordPress/gutenberg#55461. WDYT?

@fluiddot
Copy link
Contributor

@fluiddot from reviewing the stack trace and the crash's first occurrence in WP 23.6.0.1/GBM 1.107.0, this seems related to WordPress/gutenberg#55461. WDYT?

@dcalhoun Yeah, it definitely looks related to changes introduced in WordPress/gutenberg#55461. Seems this line that tries to serialize the Classic block fails. Specifically, when getting the block attributes (reference). We'd need to explore a user session and check the Classic block content being serialized to narrow down the culprit.

@fluiddot
Copy link
Contributor

fluiddot commented Nov 29, 2023

This issue seems quite related to another one we have on Android: #6084. I wonder if both are caused by the same issue related to block serialization.

@derekblank
Copy link
Contributor

I'll assign myself too to this one as part of the #6084 investigations.

@derekblank derekblank self-assigned this Nov 30, 2023
@fluiddot
Copy link
Contributor

fluiddot commented Dec 1, 2023

Heads up that I found out the steps to reproduce it and added them to the PR's description.

@fluiddot
Copy link
Contributor

fluiddot commented Dec 1, 2023

I also narrowed down the culprit of the crash 🎊. The following HTML code is processed by the raw-handling logic as a HTML block. However, since we don't support that block, the process for converting it to blocks fails and leads to a crash.

<div>
<p>Hello world!</p>
</div>

Copy link
Author

sentry-io bot commented Dec 7, 2023

Sentry issue: JETPACK-IOS-16MC

Symbolicated stack trace
RCTFatalException: Unhandled JS Exception: TypeError: Cannot read property 'attributes' of undefined

This error is located at:
    in _
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in A
    in Unknown
    in RCTView
    in Unknown
  ...: Unhandled JS Exception: TypeError: Cannot read property 'attributes' of undefined

This error is located at:
    in _
    in RCTView
    in Unknown
    in RCTView
    in Unkno..., stack:
/workdir/gutenberg/packages/blocks/src/api/parser/get-block-attributes.js:282:getBlockAttributes
/workdir/gutenberg/packages/blocks/src/api/raw-handling/html-to-blocks.js:34:Array.from.flatMap$argument_0
/workdir/gutenberg/packages/blocks/src/api/raw-handling/html-to-blocks.js:24:htmlToBlocks
/workdir/gutenberg/packages/blocks/src/api/raw-handling/index.js:74:pieces.map$argument_0
/workdir/gutenberg/packages/blocks/src/api/raw-handling/index.js:50:rawHandler
/workdir/gutenberg/packages/block-editor/src/components/inserter/hooks/use-clipboard-block.native.js:18:useClipboardBlock
/workdir/gutenberg/packages/block-editor/src/components/inserter/block-types-tab.native.js:23:BlockTypesTab
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3525:renderWithHooks
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7743:beginWork$1
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7304:performUnitOfWork
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7297:workLoopSync
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7279:renderRootSync
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6975:performSyncWorkOnRoot
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:2145:flushSyncCallbacks
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8462:batchedUpdatesImpl
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1106:batchedUpdates
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1137:_receiveRootNodeIDEvent
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1209:ReactNativePrivateInterface.RCTEventEmitter.register$argument_0.receiveTouches
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:427:__callFunction
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:113:__guard$argument_0
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:368:__guard
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:callFunctionReturnFlushedQueue

  ?, in RCTFatal
  ?, in -[RCTExceptionsManager reportFatal:stack:exceptionId:extraDataAsJSON:]
  ?, in -[RCTExceptionsManager reportException:]
  ?, in -[RCTModuleMethod invokeWithBridge:module:arguments:]
  ?, in facebook::react::invokeInner
...
(14 additional frame(s) were not displayed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants