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
Expo Notifications crashes app on reload #15788
Comments
This is also happening to me when I'm launching various builds using QR codes in a custom dev-client. |
does anyone know of a temporary workaround? |
For me it is :
I'm sending local push notifications, and onHandler seems to cause this. |
Just to verify that, this exactly is the same problem which occurs only after the reload, but for me it is about And it's really serious! |
Just importing |
yep same exact thing for me |
Same here. |
Same here. |
Same here. |
same here:
|
For anyone having this issue, it has nothing to do with your notification configuration keys and push notification at all, I'm basically using it as just a local notification builder and still get that error not even using the |
following -- same here at RN 0.64.3 & Expo 44.0.6
|
Seems to be fixed in 0.14.1 |
we've been using 0.14.1, and it hasn't been fixed for us. we've written a hacky shim to get around this in dev |
Could be nice if you would have shared your workaround |
ah yeah i mean it's just do not import if on iOS and
|
Thanks for sharing! I think that's actually the best workaround anyone can come up with right now. |
I can confirm this issue. |
still an issue with the latest versions of |
Experiencing the same problem |
Did some digging, found that this line leads to crash on dev client reloads. This line is calling Attaching some logs when it crashes. It tries to send the event but the bridge is not set. I am not sure why the bridge could be nil, maybe some race condition, will have to dig more 😅
|
@intergalacticspacehighway when you say the bridge is not set, this reminds me of: As soon as dev-client reloads, it crashes mmkv as well. Maybe these issues are related. |
Could it have to do with this issue? I do also have a warning log about the RCT bridge when I load the app. #14766 I remember fixing the RCT bridge warning message with some changes to AppDelegate mentioned here facebook/react-native#16376, but that still didn't fix this issue. |
I solved it by replacing all ./expo-notifications.js// eslint-disable-next-line no-undef, @typescript-eslint/no-var-requires, import/order
const { Platform } = require('react-native');
/** @type {typeof import('expo-notifications/src/index')} */
const mockedNotifications = {
getDevicePushTokenAsync: (() => Promise.resolve({})),
getExpoPushTokenAsync: (() => Promise.resolve({})),
getPresentedNotificationsAsync: (() => Promise.resolve({})),
presentNotificationAsync: (() => Promise.resolve({})),
dismissNotificationAsync: (() => Promise.resolve({})),
dismissAllNotificationsAsync: (() => Promise.resolve({})),
getNotificationChannelsAsync: (() => Promise.resolve({})),
getNotificationChannelAsync: (() => Promise.resolve({})),
setNotificationChannelAsync: (() => Promise.resolve({})),
deleteNotificationChannelAsync: (() => Promise.resolve({})),
getNotificationChannelGroupsAsync: (() => Promise.resolve({})),
getNotificationChannelGroupAsync: (() => Promise.resolve({})),
setNotificationChannelGroupAsync: (() => Promise.resolve({})),
deleteNotificationChannelGroupAsync: (() => Promise.resolve({})),
getBadgeCountAsync: (() => Promise.resolve({})),
setBadgeCountAsync: (() => Promise.resolve({})),
getAllScheduledNotificationsAsync: (() => Promise.resolve({})),
scheduleNotificationAsync: (() => Promise.resolve({})),
cancelScheduledNotificationAsync: (() => Promise.resolve({})),
cancelAllScheduledNotificationsAsync: (() => Promise.resolve({})),
getNotificationCategoriesAsync: (() => Promise.resolve({})),
setNotificationCategoryAsync: (() => Promise.resolve({})),
deleteNotificationCategoryAsync: (() => Promise.resolve({})),
getNextTriggerDateAsync: (() => Promise.resolve({})),
useLastNotificationResponse: (() => Promise.resolve({})),
setAutoServerRegistrationEnabledAsync: (() => Promise.resolve({})),
registerTaskAsync: (() => Promise.resolve({})),
unregisterTaskAsync: (() => Promise.resolve({})),
addPushTokenListener: (() => Promise.resolve({ remove: () => {} })),
removePushTokenSubscription: (() => Promise.resolve({})),
addNotificationReceivedListener: (() => Promise.resolve({ remove: () => {} })),
addNotificationsDroppedListener: (() => Promise.resolve({ remove: () => {} })),
addNotificationResponseReceivedListener: (() => Promise.resolve({ remove: () => {} })),
removeNotificationSubscription: (() => Promise.resolve({})),
getLastNotificationResponseAsync: (() => Promise.resolve({})),
setNotificationHandler: (() => Promise.resolve({})),
getPermissionsAsync: (() => Promise.resolve({})),
requestPermissionsAsync: (() => Promise.resolve({})),
usePermissions: (() => Promise.resolve({})),
AndroidAudioContentType: {},
AndroidAudioUsage: {},
AndroidImportance: {},
AndroidNotificationPriority: {},
AndroidNotificationVisibility: {},
DEFAULT_ACTION_IDENTIFIER: 'DEFAULT_ACTION_IDENTIFIER',
IosAlertStyle: {},
IosAllowsPreviews: {},
IosAuthorizationStatus: {},
NotificationTimeoutError: {},
};
// eslint-disable-next-line no-undef
const toExport = __DEV__ && Platform.OS === 'ios' ? { ...mockedNotifications, default: mockedNotifications } : require('expo-notifications');
// eslint-disable-next-line no-undef, @typescript-eslint/no-var-requires
// const toExport = require('expo-notifications');
/** @type {typeof import('expo-notifications/src/index')} */
module.exports = toExport; // eslint-disable-line functional/immutable-data, @typescript-eslint/no-var-requires Just save it as a file locally and import from this instead of directly from |
I am also having this issue on iOS using the dev client. |
This is also a major issue for us. |
up, still persist. It fails for us in Prod release via EAS. I think it's critical issue |
It got finally assigned to a dev, guess it will be fixed soon :) |
not working for me as well! can't publish my application.. |
You can publish. This crash only occurs while developing, not in a release build. |
@hirbod it looks like this is not totally correct. Maybe somewhat with our setup, but in production it doesn't work as well, crashes the app and we can see the same error message in sentry. (we use eas build) |
Are you reloading your app with expo-updates? Otherwise this should not happen. I only have this crash when I reload the app while developing @Eugene-Kai, not while in production |
@hirbod good point! I found the issue, that was on our side. Thank you! It works in production |
I dont understand why expo is not addressing this issue. It is really frustrating developer experience not being able to reload ios devices. It has been there for 4 months. It seriously kills the will to develop |
@ajsmth is assigned to this and investigating. if you'd like to help out you can also investigate and open a pr :) |
I wish I could : ( |
hang tight, or look at #15788 (comment) and possibly try applying that suggestion to your project |
# Why Closes #15788. Right now, modules have not been deallocated on the reload. # How Remove cycle reference. # Test plan - expo go ✅
Closes #15788. Right now, modules have not been deallocated on the reload. Remove cycle reference. - expo go ✅
Closes #15788. Right now, modules have not been deallocated on the reload. Remove cycle reference. - expo go ✅
You guys should re-open a new ticket for this and provide a repro |
Summary
Expo Notifications 0.14.0 will crash an expo-dev-client build on an Ios device on app reload.
The app will crash with...
The app does not crash when using Expo Go.
Somewhat similar issue.
#3276
Managed or bare workflow? If you have
ios/
orandroid/
directories in your project, the answer is bare!managed
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
44
Environment
Expo CLI 5.0.3 environment info:
System:
OS: macOS 12.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
npm: 8.3.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Managers:
CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
IDEs:
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
npmPackages:
expo: ~44.0.0 => 44.0.3
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
npmGlobalPackages:
eas-cli: 0.43.0
expo-cli: 5.0.3
Expo Workflow: managed
Reproducible demo
The text was updated successfully, but these errors were encountered: