braze-inc / braze-expo-plugin

Other
11 stars 10 forks source link

[Bug]: Integration of Rich Notification on iOS errors out EAS Build #30

Closed mvolonnino closed 4 months ago

mvolonnino commented 6 months ago

Which Platforms?

iOS

Which React Native Version?

0.73.6

Which @braze/expo-plugin version?

^2.1.0

Which @braze/react-native-sdk SDK version?

^8.3.0

Repro Rate

100%

Steps To Reproduce

Run a release build through EAS and it fails to build each time while enableBrazeIosRichPush is set to true in the app.config.ts. Removing that flag in the braze plugin allows for the build to succeed.

Expected Behavior

Build should not fail, and rich notification support should be enabled for iOS & braze push notifications

Actual Incorrect Behavior

App fails to build during the fastlane setup through EAS.

Verbose Logs

➜ Explicit dependency on target 'BrazeExpoRichPush' in project 'Volo'
        ➜ Implicit dependency on target 'BrazeUI' in project 'Pods' via options '-framework BrazeUI' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'ExpoAdapterBraze' in project 'Pods' via options '-framework ExpoAdapterBraze' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'braze-react-native-sdk' in project 'Pods' via options '-framework braze_react_native_sdk' in build setting 'OTHER_LDFLAGS'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeLocation' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeUI' in project 'Pods'
        ➜ Explicit dependency on target 'ExpoAdapterBraze' in project 'Pods'
        ➜ Explicit dependency on target 'braze-react-native-sdk' in project 'Pods'
    Target 'ExpoAdapterBraze' in project 'Pods'
        ➜ Explicit dependency on target 'braze-react-native-sdk' in project 'Pods'
    Target 'braze-react-native-sdk' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeLocation' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeUI' in project 'Pods'
    Target 'BrazeUI' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeUI-BrazeUI' in project 'Pods'
    Target 'BrazeUI-BrazeUI' in project 'Pods' (no dependencies)
    Target 'BrazeLocation' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeLocation-BrazeLocation' in project 'Pods'
    Target 'BrazeLocation-BrazeLocation' in project 'Pods' (no dependencies)
    Target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit-BrazeKit' in project 'Pods'
    Target 'BrazeKit-BrazeKit' in project 'Pods' (no dependencies)
    Target 'BrazeExpoRichPush' in project 'Volo'
        ➜ Implicit dependency on target 'Pods-BrazeExpoRichPush' in project 'Pods' via file 'Pods_BrazeExpoRichPush.framework' in build phase 'Link Binary'
    Target 'Pods-BrazeExpoRichPush' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeNotificationService' in project 'Pods'
    Target 'BrazeNotificationService' in project 'Pods' (no dependencies)
/Users/expo/workingdir/build/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'BrazeUI-BrazeUI' from project 'Pods')
/Users/expo/workingdir/build/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'BrazeLocation-BrazeLocation' from project 'Pods')
/Users/expo/workingdir/build/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'BrazeKit-BrazeKit' from project 'Pods')
/Users/expo/workingdir/build/ios/Volo.xcodeproj: error: Signing for "BrazeExpoRichPush" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'BrazeExpoRichPush' from project 'Volo')

Additional Information

@jerielng - now this is awesome! One question though as I am running into build errors when updating everything to expo sdk50 & updating to the latest 2.1.0 version.

Getting this build error in the eas-build process:

Starting from Xcode 14, resource bundles are signed by default, which requires setting the development team for each resource bundle target.

and from inspecting the xcode logs, im seeing this issue:

        ➜ Explicit dependency on target 'BrazeExpoRichPush' in project 'Volo'
        ➜ Implicit dependency on target 'BrazeUI' in project 'Pods' via options '-framework BrazeUI' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'ExpoAdapterBraze' in project 'Pods' via options '-framework ExpoAdapterBraze' in build setting 'OTHER_LDFLAGS'
        ➜ Implicit dependency on target 'braze-react-native-sdk' in project 'Pods' via options '-framework braze_react_native_sdk' in build setting 'OTHER_LDFLAGS'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeLocation' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeUI' in project 'Pods'
        ➜ Explicit dependency on target 'ExpoAdapterBraze' in project 'Pods'
        ➜ Explicit dependency on target 'braze-react-native-sdk' in project 'Pods'
    Target 'ExpoAdapterBraze' in project 'Pods'
        ➜ Explicit dependency on target 'braze-react-native-sdk' in project 'Pods'
    Target 'braze-react-native-sdk' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeLocation' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeUI' in project 'Pods'
    Target 'BrazeUI' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeUI-BrazeUI' in project 'Pods'
    Target 'BrazeUI-BrazeUI' in project 'Pods' (no dependencies)
    Target 'BrazeLocation' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeLocation-BrazeLocation' in project 'Pods'
    Target 'BrazeLocation-BrazeLocation' in project 'Pods' (no dependencies)
    Target 'BrazeKit' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeKit-BrazeKit' in project 'Pods'
    Target 'BrazeKit-BrazeKit' in project 'Pods' (no dependencies)
    Target 'BrazeExpoRichPush' in project 'Volo'
        ➜ Implicit dependency on target 'Pods-BrazeExpoRichPush' in project 'Pods' via file 'Pods_BrazeExpoRichPush.framework' in build phase 'Link Binary'
    Target 'Pods-BrazeExpoRichPush' in project 'Pods'
        ➜ Explicit dependency on target 'BrazeNotificationService' in project 'Pods'
    Target 'BrazeNotificationService' in project 'Pods' (no dependencies)
/Users/expo/workingdir/build/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'BrazeLocation-BrazeLocation' from project 'Pods')
/Users/expo/workingdir/build/ios/Volo.xcodeproj: error: Signing for "BrazeExpoRichPush" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'BrazeExpoRichPush' from project 'Volo')
/Users/expo/workingdir/build/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'BrazeUI-BrazeUI' from project 'Pods')
/Users/expo/workingdir/build/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'BrazeKit-BrazeKit' from project 'Pods')

Looks like its failing on the signing for the Rich Push notifications. I could not find anything on this for the expo config plugin - so wondering how to handle this here and allow the rich push notifications in the latest 2.1.0!

jerielng commented 5 months ago

Hey @mvolonnino, we've released version 2.1.1 of this Expo plugin. Could you verify if this resolves your issue? Thanks!

mvolonnino commented 5 months ago

@jerielng - Awesome! Im a little backed up, but will get to this within the next week 🔥

jerielng commented 5 months ago

@mvolonnino We've gotten word that 2.1.1 may not fully address some of these code signing issues, so we're taking a deeper look into it. Sorry for the back and forth, but we'll keep you updated as much as we can when we have a more holistic fix. Thanks!

krazykriskomar commented 5 months ago

Hi there @jerielng. Kris Komar from The Krazy Coupon lady here. I'm lead architect here. We use Braze and Expo here at KCL. Just letting you know we are experiencing an issue with rich pushes not working in iOS in Expo and it looks like this particular issue might be the culprit. Specifically, when we build with enableBrazeIosRichPush = true, the build fails. Do you need any other data? I'm happy to provide it. How's the fix for this going? Do you know when there might be a new version to remedy this? Would you like any other assistance in the matter?

My initial findings on the issue are that this package may be trying to write a duplicate value into the info.plist. Or perhaps it's a build command ordering issue. We had the build fail on a custom plugin that claimed your build steps needed the custom plugin's steps, which wouldn't make sense. So I think there's a system-level build issue going on here. I am going to investigate more tomorrow.

Thanks in advance!

jerielng commented 4 months ago

Hi @krazykriskomar, we currently have the fix on a preview repo here if you would like to temporarily point your project to it. If this fix fully resolves the issue for you, let us know!

krazykriskomar commented 4 months ago

Hi @krazykriskomar, we currently have the fix on a preview repo here if you would like to temporarily point your project to it. If this fix fully resolves the issue for you, let us know!

@jerielng I would love to test it out! :D How do I consume this? Is it on npmjs or do I need to manually download the source?

jerielng commented 4 months ago

@krazykriskomar You can update the pointer in your package.json. Instead of using a version number, you can either clone the repo locally and refer to it like so:

"@braze/expo-plugin": "file:<relative-path-to>/braze-expo-plugin-eas-preview",

or you can use the direct Git link (If you are not using SSH, there are some examples of additional configurations here):

"@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",
krazykriskomar commented 4 months ago

@krazykriskomar You can update the pointer in your package.json. Instead of using a version number, you can either clone the repo locally and refer to it like so:

"@braze/expo-plugin": "file:<relative-path-to>/braze-expo-plugin-eas-preview",

or you can use the direct Git link (If you are not using SSH, there are some examples of additional configurations here):

"@braze/expo-plugin": "git+ssh://github.com/braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",

You're a lifesaver, thank you! :D

krazykriskomar commented 4 months ago

@jerielng it's giving me an error on expo install

image

Do I perhaps need to modify my app.config.js? It currently looks like this:

image

And I changed package.json as such:

image
jerielng commented 4 months ago

@krazykriskomar Looks like there was a typo in that link, sorry. It should be this if you're using SSH:

"@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",
krazykriskomar commented 4 months ago

@krazykriskomar Looks like there was a typo in that link, sorry. It should be this if you're using SSH:

"@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",

@jerielng thank you for your help! When were you guys planning to push this to prod/npm?

jerielng commented 4 months ago

@krazykriskomar Looks like there was a typo in that link, sorry. It should be this if you're using SSH:

"@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",

@jerielng thank you for your help! When were you guys planning to push this to prod/npm?

We're hoping to get this pushed to our main repo shortly. We'll keep you updated on a timeline for it. Thanks!

krazykriskomar commented 4 months ago

Hi @jerielng not sure if this is related to what you're fixing, but when I build a release version with 2.1.2 code, i get this: error: No profiles for 'com.thekrazycouponlady.Krazy-Coupon-Lady.BrazeExpoRichPush' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.thekrazycouponlady.Krazy-Coupon-Lady.BrazeExpoRichPush'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'BrazeExpoRichPush' from project 'KrazyCouponLady')

jerielng commented 4 months ago

Hey @krazykriskomar Do you happen to have a minimum reproducible sample of this issue that you can share with our support team at support@braze.com? We're not able to reproduce this from our end. The automatic signing configuration should already be enabled for each of the rich push and push stories extensions as part of the script that generates these targets.

krazykriskomar commented 4 months ago

@jerielng I'll work on creating a reproducible version. Question for you: I downloaded a copy of the preview repo last Wednesday and that's the code I'm working on. Have you made any updates that I might need to update since then?

jerielng commented 4 months ago

Hey @krazykriskomar, we haven't made any updates to that repo.

One other troubleshooting step I would also recommend is checking that you've added the app extension bundle IDs to your Expo project configurations so that when you run the eas build step, you are able to generate the provisioning profiles for them. There's a couple of ways you can do this depending on how you typically manage code signing in your project. Here's one such example. Or you can also add it to your credentials.json if that's where you normally keep your code signing properties.

krazykriskomar commented 4 months ago

Hey @krazykriskomar, we haven't made any updates to that repo.

One other troubleshooting step I would also recommend is checking that you've added the app extension bundle IDs to your Expo project configurations so that when you run the eas build step, you are able to generate the provisioning profiles for them. There's a couple of ways you can do this depending on how you typically manage code signing in your project. Here's one such example. Or you can also add it to your credentials.json if that's where you normally keep your code signing properties.

@jerielng if there is extra setup required to use this plugin, perhaps I missed it. Where is this setup/config in the documentation?

jerielng commented 4 months ago

@krazykriskomar If you are using EAS CLI, you'll need to take some additional steps to ensure that:

We don't currently have these documented as they can be specific based on the project that uses EAS, but we'll look into getting it updated on our public docs here once we have made a public release of the new changes.

krazykriskomar commented 4 months ago

@jerielng figured it out! I had to run an expo build locally. We use CI for our builds and CI cannot create provisioning certs.

YentingChen commented 4 months ago

Hi @jerielng I tried to point to the repository by updating the plugin to

"@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",

but I still got the error when executing expo rebuild

Screenshot 2024-06-11 at 16 01 35

The build folder does not seem to have been generated. Screenshot 2024-06-11 at 16 22 14

Could you please help? Thank you.

jerielng commented 4 months ago

Hi @jerielng I tried to point to the repository by updating the plugin to

"@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",

but I still got the error when executing expo rebuild

Screenshot 2024-06-11 at 16 01 35

The build folder does not seem to have been generated. Screenshot 2024-06-11 at 16 22 14

Could you please help? Thank you.

Hey @YentingChen, it looks like the plugin files aren't being synced. Could you alternatively try cloning the repo and pointing to a local build using the file: syntax?

We're hoping to get this published soon after it goes through some internal review, so you should be able to point directly to our NPM instance once the new version has been released.

krazykriskomar commented 4 months ago

Hi @jerielng I tried to point to the repository by updating the plugin to

"@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2",

but I still got the error when executing expo rebuild

Screenshot 2024-06-11 at 16 01 35

The build folder does not seem to have been generated. Screenshot 2024-06-11 at 16 22 14

Could you please help? Thank you.

@YentingChen This is happening because there are no compiled binaries. What i had to do was pull down the code and host it in my repo, then add this to the scripts in package.json: "prepare": "expo-module prepare" it will compile when you npm install.

YentingChen commented 4 months ago

Hi @jerielng I tried to point to the repository by updating the plugin to "@braze/expo-plugin": "git+ssh://git@github.com:braze-inc/braze-expo-plugin-eas-preview.git#2.1.2", but I still got the error when executing expo rebuild Screenshot 2024-06-11 at 16 01 35 The build folder does not seem to have been generated. Screenshot 2024-06-11 at 16 22 14 Could you please help? Thank you.

@YentingChen This is happening because there are no compiled binaries. What i had to do was pull down the code and host it in my repo, then add this to the scripts in package.json: "prepare": "expo-module prepare" it will compile when you npm install.

Hi @krazykriskomar

Thank you for the suggestion, which helps. Can you share your methods of using EAS build? Thank you. I got the error only through the EAS build, but the locally build works fine.

Screenshot 2024-06-12 at 17 39 13
krazykriskomar commented 4 months ago

@YentingChen Ah yes, since EAS build does a npm ci and not an npm install, it won't do anything extra, like install does. The way I solved it was to download the repo and add it as an Expo plugin. Xnip2024-06-13_08-43-47

jerielng commented 4 months ago

Hi all, upon closer review, it looks like there are no additional configurations/changes needed to successfully code-sign when building with EAS. This means that the appleTeamId configuration that was in the preview repo should not be necessary. To get this working end-to-end, you'll need to ensure that the bundle IDs for each app extension is added to your project configuration, as described here.

The currently released version should have everything needed to successfully build on EAS, but we've published some sample app updates in version 2.1.2 for further guidance and will have some updated documentation out shortly, which will live here when it's published.

I'll close out this issue, but please feel free to re-open it if you face any additional issues. Thanks!