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: undefined is not an object (evaluating 'n.title.raw') This error is lo...: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'n.title.raw') #5496

Closed
sentry-io bot opened this issue Feb 22, 2023 · 9 comments
Labels

Comments

@sentry-io
Copy link

sentry-io bot commented Feb 22, 2023

Sentry Issue: JETPACK-IOS-P5

Metrics:

  • First seen in: 21.7.0.3
  • Affecting 2 users so far (Feb 22nd, 2023)
RCTFatalException: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'n.title.raw')

This error is located at:
    in B
    in y
    in y
    in WithPreferredColorScheme(y)
    in Unknown
    in WithSelect(WithPreferredColorSchem...: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'n.title.raw')

This error is located at:
    in B
    in y
    in y
    in WithPreferredColorScheme(..., stack:
gutenberg-mobile/gutenberg/packages/block-editor/src/store/selectors.js:1975:buildReusableBlockInserterItem
gutenberg-mobile/gutenberg/packages/block-editor/src/store/selectors.js:1996:createSelector$argument_0
gutenberg-mobile/gutenberg/node_modules/rememo/rememo.js:270:callSelector
gutenberg-mobile/gutenberg/packages/data/src/redux-store/index.js:193:<anonymous>
gutenberg-mobile/gutenberg/packages/data/src/redux-store/index.js:367:runSelector
gutenberg-mobile/gutenberg/packages/block-editor/src/components/inserter/menu.native.js:70:useSelect$argument_0
gutenberg-mobile/gutenberg/packages/data/src/components/use-select/index.js:82:selectValue
gutenberg-mobile/gutenberg/packages/data/src/registry.js:128:__unstableMarkListeningStores
gutenberg-mobile/gutenberg/packages/data/src/registry.js:206:<anonymous>
gutenberg-mobile/gutenberg/packages/data/src/components/use-select/index.js:125:updateValue$argument_0
gutenberg-mobile/gutenberg/packages/data/src/components/use-select/index.js:92:updateValue
gutenberg-mobile/gutenberg/packages/data/src/components/use-select/index.js:124:<anonymous>
gutenberg-mobile/gutenberg/packages/data/src/components/use-select/index.js:152:useMappingSelect
gutenberg-mobile/gutenberg/packages/data/src/components/use-select/index.js:241:useSelect
gutenberg-mobile/gutenberg/packages/block-editor/src/components/inserter/menu.native.js:53:InserterMenu
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3441:renderWithHooks
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7389:beginWork$1
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6982:performUnitOfWork
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6975:workLoopSync
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6957:renderRootSync
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6656:performSyncWorkOnRoot
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:2139:flushSyncCallbacks
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8099:batchedUpdatesImpl
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1106:batchedUpdates
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1137:_receiveRootNodeIDEvent
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1209:ReactNativePrivateInterface.RCTEventEmitter.register$argument_0.receiveTouches
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:417:__callFunction
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:114:__guard$argument_0
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:368:__guard
gutenberg-mobile/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:113:callFunctionReturnFlushedQueue

  File "RCTAssert.m", line 147, in RCTFatal
  File "RCTExceptionsManager.mm", line 77, in -[RCTExceptionsManager reportFatal:stack:exceptionId:extraDataAsJSON:]
  File "RCTExceptionsManager.mm", line 147, in -[RCTExceptionsManager reportException:]
  File "RCTModuleMethod.mm", line 584, in -[RCTModuleMethod invokeWithBridge:module:arguments:]
  File "RCTNativeModule.mm", line 183, in facebook::react::invokeInner
...
(14 additional frame(s) were not displayed)
@fluiddot fluiddot added the [Type] Bug Something isn't working label Feb 22, 2023
@fluiddot fluiddot transferred this issue from wordpress-mobile/WordPress-iOS Feb 22, 2023
@jhnstn
Copy link
Member

jhnstn commented Mar 27, 2023

@jhnstn
Copy link
Member

jhnstn commented Mar 27, 2023

When a reusable block has no title

I tried recreating this one by creating a reusable block without a title. The app handles that fine and it appears there is a default value in the block data.

I also looked into the sites connected to the errors. Seems like there are some Jetpack connection issues which could be related.

Marking as low priority since it's only impacting a few customers.

@sentry-io
Copy link
Author

sentry-io bot commented Aug 21, 2023

Sentry issue: JETPACK-IOS-13FB

@SiobhyB
Copy link
Contributor

SiobhyB commented Aug 23, 2023

A few notes on this issue:

  • I reviewed a number of impacted sites and found that most didn't have any reusable blocks/synced patterns. If the buildReusableBlockInserterItem function is being incorrectly called in that case, it would make sense that it resulted in the error shown.
  • I noticed that the crash mostly happened with pages, not posts. I wonder if it could be related to the fact that many pages have unsynced patterns associated with them. Perhaps there is something related to patterns causing the function to be called.
  • Attempts to reproduce haven't been successful. The potential fix in [RNMobile] Add optional chaining to reusableBlock.title  WordPress/gutenberg#53721 led to the same crash showing up with a slightly different stack trace in Sentry.
  • I'm going to be AFK until September 1st, but plan to resume investigations if no one beats me to it then.

@SiobhyB
Copy link
Contributor

SiobhyB commented Aug 23, 2023

Adding the most recent symbolicated trace for reference:

This error is located at:
    in C
    in y
    in R
    in WithPreferredColorScheme(R)
    in Unkn..., stack:
/workdir/gutenberg/packages/block-editor/src/store/selectors.js:280:createSelector$argument_0
/workdir/gutenberg/packages/block-editor/src/store/selectors.js:212:createSelector$argument_1
/workdir/gutenberg/node_modules/uuid/dist/rng-browser.js:12:<global>
/workdir/gutenberg/packages/deprecated/src/index.js:54:deprecated
/workdir/gutenberg/packages/block-editor/src/components/inserter/index.native.js:11:<global>
/workdir/gutenberg/packages/data/src/controls.js:106:dispatch
/workdir/gutenberg/packages/blocks/src/store/index.js:14:<global>
null:null:null
/workdir/gutenberg/packages/data/src/controls.js:74:resolveSelect
/workdir/gutenberg/packages/data/src/controls.js:39:select
/workdir/gutenberg/packages/data/src/lock-unlock.js:10:<global>
null:null:null
/workdir/gutenberg/packages/block-editor/src/components/button-block-appender/index.native.js:29:ButtonBlockAppender
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3535:renderWithHooks
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7755:beginWork$1
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7307:performUnitOfWork
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7301:workLoopConcurrent
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7292:renderRootSync
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6977:performSyncWorkOnRoot
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:2148:flushSyncCallbacks
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8461:batchedUpdatesImpl
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1103:batchedUpdates
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1141:batchedUpdates$argument_0
/workdir/gutenberg/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1214:getFiberCurrentPropsFromNode
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:245:enqueueNativeCall
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:11:<global>
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:127:invokeCallbackAndReturnFlushedQueue
/workdir/gutenberg/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:11:<global>

@SiobhyB
Copy link
Contributor

SiobhyB commented Sep 25, 2023

Summary

Here's a rundown of the number of events Sentry reported for the initial undefined is not an object (evaluating 'n.title.raw') crash (JETPACK-IOS-P5) reported in this issue:

  • 22.6: 29 events
  • 22.7: 30 events
  • 22.8: 187 events
  • 22.9: 101 events

In WordPress/gutenberg#53721, optional chaining was added to the n.title.raw object referenced in the crash error message.

A "new" crash then appeared in Sentry: TypeError: Cannot read property 'raw' of undefined (JETPACK-IOS-13FB). I assumed the root of this crash was the same as the crash we'd hoped to resolve with this issue. Similarities, aside from the raw reference, include mentions of the inserter in the stack trace. However, the occurrence of these crashes are, so far, lower than the original at its peak:

  • 23.0: 75 events.
  • 23.1: 46 events.
  • 23.2: 4 events (still in rollout).

As per these notes, the crash has continued to prove tricky to reproduce, but it feels as though WordPress/gutenberg#53721 did help towards reducing the crashes.

Next Steps

I've proposed some extra safety checks around references to raw in WordPress/gutenberg#54792. I will unassign myself from this issue for now, as I don't plan to spend further time on it beyond monitoring it in future releases.

For future digging, I noticed that recent stack traces vary, so it could be valuable to collect multiple different traces from different users and compare for any similarities.

@kean
Copy link

kean commented Sep 28, 2023

It is peaking again in 23.2 currently, but I'm not sure it's actually the same exact event.

Screenshot 2023-09-28 at 12 22 05 PM

@SiobhyB
Copy link
Contributor

SiobhyB commented Sep 28, 2023

@kean, thank you for monitoring! The latest attempt at addressing this (WordPress/gutenberg#54792) will be included in 23.4.

@fluiddot
Copy link
Contributor

I confirmed that this issue is not happening in 23.4 (after this fix was merged) with 77% adoption. Hence, we can consider it solved and we can proceed to close the issue 🎊.

@github-project-automation github-project-automation bot moved this to Done (keep clean, manually) in Mobile Gutenberg Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done (keep clean, manually)
Development

No branches or pull requests

4 participants