onesignal-expo-plugin
onesignal-expo-plugin copied to clipboard
[Bug]: Does not work unless OneSignal is the first plugin to modify notification settings on iOS
What happened?
I had two plugins that modified notification settings in my expo-dev-client SDK v47 app. I had "onesignal-expo-plugin"
and "config-plugin-react-native-intercom"
and a few others as well.
I followed the setup guides for OneSignal and Expo thoroughly. However, my app gave the Missing Push Capability
error on the OneSignal dashboard.
The way I fixed it was moving onesignal-expo-plugin
above all the other plugins that modified any notification settings.
Steps to reproduce?
1. Setup OneSignal on expo-dev-client app with this config plugin. Make sure APNS delegate fires.
2. Install another config plugin that modifies notifications settings like the Intercom config plugin (Intercom is a good example because OneSignal uses Intercom internally as well)
3. Build the app locally or using EAS
4. Open the app on a production device.
5. Check out the OneSignal dashboard and you will see the error "Missing Push Capability" alongside your device.
What did you expect to happen?
Push notifications should work, but they don't.
OneSignal Expo SDK version
"react-native-onesignal": "^4.5.0", "onesignal-expo-plugin": "^1.3.0",
Platform
iOS
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@ansh , Thanks for reporting this. I'm happy you're able to find our workaround.
We are currently aware of this issue and have it documented in our setup guide (we specifically mention the order being important).
Ideally, we will be able to fix this in the future so it is not a requirement.
@rgomezp Oh! Where is it in the documentation? I mustβve misssed it.
This randomly stopped working again. Just randomly, no idea what happened. Super super frustrating! Even though OneSignal is the FIRST thing in the plugins array.
Hey Ansh. The documentation is here.
To debug, I recommend ejecting to a bare workflow and inspecting the capabilities files manually. See docs.
@rgomezp I did that and what I found was extremely odd. For some reason even if the OneSignal package is first, sometimes it works and sometimes it doesnβt work. It is quite odd but changing the order if it stops working and changing it back can be used as a workaround. That is however not a real fix at all. This needs to be addressed at a package level.
Agreed^^ We are also experiencing a lot of issues related to this π
[
'onesignal-expo-plugin',
{
mode: 'x',
devTeam: 'x',
iPhoneDeploymentTarget: 'x',
},
],
'@config-plugins/react-native-blob-util',
'@config-plugins/react-native-pdf',
['expo-build-properties', obj],
['config-plugin-react-native-intercom', obj],
'react-native-health',
]
With expo config --type introspec
i can confirm the onesignal entitlement is there
Thanks in advance
Howdy y'all. So to summarize, you're seeing issues even with the plugin being listed first. Is that correct?
Thanks for your patience while we investigate.
Correct π
@Eigilak or @ansh would you be able to post the "Config Syncing" output of an expo prebuild
that has failed to add the proper entitlements, with debugging enabled:
export EXPO_DEBUG=true
expo prebuild
The part of the output I'm interested in looks something like this:
- Config syncing
ios.entitlements: withDefaultBaseMods β withIosBaseMods β withGeneratedBaseMods β withIosEntitlementsBaseMod
- Config syncing
ios.entitlements: withIosExpoPlugins β withPlugins β withStaticPlugin β withAssociatedDomains β withEntitlementsPlist
- Config syncing
ios.entitlements: withFallback β withPlugins β withStaticPlugin β withNotificationsEntitlement β withEntitlementsPlist
- Config syncing
ios.entitlements: withStaticPlugin β withExpoContacts β withRunOnce β withAccessesContactNotes β withEntitlementsPlist
- Config syncing
ios.entitlements: withStaticPlugin β withExpoAppleAuthentication β withRunOnce β withAppleSignInWarning β withEntitlementsPlist
- Config syncing
ios.entitlements: withPlugins β withStaticPlugin β withOneSignal β withOneSignalIos β withAppGroupPermissions β withEntitlementsPlist
- Config syncing
ios.entitlements: withPlugins β withStaticPlugin β withOneSignal β withOneSignalIos β withAppEnvironment β withEntitlementsPlist
- Config syncing
ios.entitlements: withConfigPlugins β withPlugins β withStaticPlugin β withHealthKit β withEntitlementsPlist
Hi there, I have noticed same issue. When one signal plugin is set to first place and we have created eas credentials brand new, notifications are working. On second build, (probably due to "eas invalidates provision profiles"), notifications aren't working (missing push notification capability). Expo team accepted bug https://github.com/expo/eas-cli/issues/1069 but there no activity on this. I am working with EXPO_NOCAPABILITY_SYNC=1 option, but no luck either.
Hello there !
If it can help, I wrote my own plugin to add iOS Share Extension (not yet publicly published) using your plugin as startup project base. When, at the end, I tried to run expo prebuild
, either OneSignal or my plugin was not added to the targets in XCode.
To solve this issue, I entirely removed all async
code (nb: I don't use pods so this part was just removed anyway) in my plugin. Then guess what ? It always work.
To conclude, my guess is more related to async stuff done in OneSignal that might struggle if other plugins are doing the same.
Cheers !
@rgomezp @brismithers Any chance to look solution from @EtienneUku ?
@RL-Jurica-Penjgusic I have not been able to see plugins not getting included on expo prebuild
for my testing apps. I've tried with various plugins and codebase sizes, thinking codebase size or number of plugins is a factor. If someone can provide a repo that reproduces this that would be super helpful. Alternatively, running expo prebuild
with expo debugging enabled to get some insight into what expo is doing might be sufficient. Thanks!
@brismithers Hi, today we ran at same issue, luckily expo debug was set to true. We have log of successfull build (no missing push capability ) and log of build that has missing push capability. So where can we send log files?
@RL-Jurica-Penjgusic you can send the logs to [email protected], please reference this github issue in the email. Thanks!
@RL-Jurica-Penjgusic logs received :)
@RL-Jurica-Penjgusic unfortunately the debug logs isn't showing anything out of the ordinary. Both logs show all plugins being included during the prebuild phase, and the expected entitlement modifications are there (see below). Can you confirm whether the ipa
file for the failing one has an entitlements file that includes what the prebuild has built up?
[PREBUILD] entitlements: {
[PREBUILD] [32m'aps-environment'[39m: [32m'production'[39m,
[PREBUILD] [32m'com.apple.developer.applesignin'[39m: [
[PREBUILD] [32m'Default'[39m
[PREBUILD] ],
[PREBUILD] [32m'com.apple.security.application-groups'[39m: [
[PREBUILD] [32m'group.XXXXXXXXXX.onesignal'[39m
[PREBUILD] ]
[PREBUILD] }
We get this from time to time
Any updates on making not requirement to have onesignal as top of the list?
I have 2 plugins fighting for this position :( what a nightmare
Which version of Expo are you on? @pettomartino
@ansh Expo 49
The issue I'm having is actually the one reported here
Same here, using expo 51. Not working even when in first place.
But everything is working for an ios development simulator build.
UPDATE:
So i needed to delete my build credentials to make it work.
What i did:
- I used eas:credentials -> Build Credentials -> Delete
- Run a build