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

[Bug]: Does not work unless OneSignal is the first plugin to modify notification settings on iOS #154

Open
1 task done
ansh opened this issue Dec 28, 2022 · 25 comments
Open
1 task done
Assignees

Comments

@ansh
Copy link

ansh commented Dec 28, 2022

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

  • I agree to follow this project's Code of Conduct
@rgomezp
Copy link
Contributor

rgomezp commented Jan 3, 2023

@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.

@ansh
Copy link
Author

ansh commented Jan 3, 2023

@rgomezp Oh! Where is it in the documentation? I must’ve misssed it.

@ansh
Copy link
Author

ansh commented Jan 4, 2023

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.

@rgomezp
Copy link
Contributor

rgomezp commented Jan 4, 2023

Hey Ansh. The documentation is here.

To debug, I recommend ejecting to a bare workflow and inspecting the capabilities files manually. See docs.

@ansh
Copy link
Author

ansh commented Jan 9, 2023

@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.

@Eigilak
Copy link

Eigilak commented Jan 16, 2023

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

@rgomezp
Copy link
Contributor

rgomezp commented Jan 19, 2023

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.

@Eigilak
Copy link

Eigilak commented Jan 19, 2023

Correct 😅

@brismithers
Copy link
Contributor

@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

@RL-Jurica-Penjgusic
Copy link

RL-Jurica-Penjgusic commented Jan 23, 2023

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.

@EtienneUku
Copy link

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 !

@RL-Jurica-Penjgusic
Copy link

@rgomezp @brismithers Any chance to look solution from @EtienneUku ?

@brismithers
Copy link
Contributor

@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!

@RL-Jurica-Penjgusic
Copy link

RL-Jurica-Penjgusic commented Mar 16, 2023

@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?

@brismithers
Copy link
Contributor

@RL-Jurica-Penjgusic you can send the logs to [email protected], please reference this github issue in the email. Thanks!

@brismithers
Copy link
Contributor

@RL-Jurica-Penjgusic logs received :)

@brismithers
Copy link
Contributor

brismithers commented Mar 24, 2023

@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]     }

@RL-Jurica-Penjgusic
Copy link

RL-Jurica-Penjgusic commented Mar 31, 2023

Notifcation
We get this from time to time

@pettomartino
Copy link

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

@ansh
Copy link
Author

ansh commented Mar 19, 2024

Which version of Expo are you on? @pettomartino

@pettomartino
Copy link

@ansh Expo 49

@pettomartino
Copy link

The issue I'm having is actually the one reported here

@oliviercperrier
Copy link

oliviercperrier commented Aug 30, 2024

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:

  1. I used eas:credentials -> Build Credentials -> Delete
  2. Run a build

@dnlsilva
Copy link

I'm experiencing this exact problem, but it gets worse when using OneSignal with FullStory — they don't work together. Both have a plugin for Expo. If I place the FullStory plugin first, it works, but then OneSignal doesn't. If I place the OneSignal plugin first, it works, but FullStory doesn't.

I tried to understand why the plugin order matters for functionality, but I couldn't reach a conclusion. Surprisingly, this seems to be an old issue without a solution (it seems it's not considered important).

Does anyone know why this happens or how to resolve it by placing the plugin in a different order?

If the issue persists, unfortunately, we'd have to switch to another notification library since user tracking is far more critical than notifications. There are plenty of libraries for notifications, but only a few do user tracking the way we need.

@nixolas1
Copy link

In our case it was due to the expo plugin of two deps (Onesignal and Expo assets or something) both overwriting a config.
So check out the expo plugin file of Fullstory and make sure it extends configs, not just sets them.

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

No branches or pull requests

10 participants