achorein / expo-share-intent

🚀 Simple share intent in an Expo Native Module
MIT License
119 stars 10 forks source link

EAS cloud build failing because of local path for ShareExtension.entitlements #32

Closed crieggalder closed 2 months ago

crieggalder commented 3 months ago

Thanks for this plugin! Really appreciate you filling a hole in the ecosystem :)

Running into a bug when building iOS for production on EAS after a fresh expo prebuild. Here's the error from Xcode logs:

/Users/expo/workingdir/build/packages/app/ios/Campfire.xcodeproj: error: The file "/Users/chris/go/campfire/packages/app/ios/ShareExtension/ShareExtension.entitlements" could not be opened. Verify the value of the CODE_SIGN_ENTITLEMENTS build setting for target "ShareExtension" is correct and that the file exists on disk. (in target 'ShareExtension' from project 'Campfire')

Clearly the problem is the local path. I'd expect this path to be relative and correct after a fresh prebuild though.

Here's the expo.extra.eas section of my app.config.js:

            eas: {
                build: {
                    experimental: {
                        ios: {
                            appExtensions: [
                                {
                                    targetName: 'OneSignalNotificationServiceExtension',
                                    bundleIdentifier: 'com.campfirechat.campfire.OneSignalNotificationServiceExtension',
                                    entitlements: {
                                        'com.apple.security.application-groups': [
                                            'group.com.campfirechat.campfire.onesignal',
                                        ],
                                    },
                                },
                            ],
                        },
                    },
                },
                projectId: 'a147d081-85ac-44f2-8b2f-86e6aec8788a',
            },

Here is the Build Phases tab in Xcode after a fresh prebuild:

Screenshot 2024-03-19 at 10 03 35 PM
achorein commented 3 months ago

🤔 strange, it works fine on my eas build. it's probably related to expo.extra.eas.build.experimental there have already been problems with this kind of thing.

achorein commented 3 months ago

we get the path from the additional properties supplied by the mod expo compiler config.modRequest.platformProjectRoot(https://docs.expo.dev/config-plugins/plugins-and-mods/#ios)

path.join(
    platformProjectRoot,
    shareExtensionName,
    shareExtensionEntitlementsFileName,
  )

it sounds like a expo bug when using experimental feature :/

crieggalder commented 3 months ago

Hm - when I remove expo.extra.eas.build.experimental, I get the same result

achorein commented 3 months ago

I cannot reproduce, you seems to be in a bare environment that i can't support. closing for now

etienne678 commented 2 months ago

i just ran into the same problem.

i tried "eas build --profile preview --platform ios --clear-cache" and i notice that in the eas logs in expo.dev build console under 'Read app config' it has expo.extra.eas.build.experimental in it.

Screenshot 2024-04-26 at 07 38 01

when running 'running npx expo config --type public' it shows that the experimental part is in there as well, so it is added somewhere in my configuration. but i do not have it in my local app.json.

i cannot find any file where i specify expo.extra.eas.build.experimental to be present. would be very thankful for help.

etienne678 commented 2 months ago

the problem seems to be that this experimental config is added by /node_modules/expo-share-intent/plugin/build/ios/withIosShareExtensionConfig.js

etienne678 commented 2 months ago

it took me around 30 hours to get this solved.

the solution for me was to create a patch for the file: /node_modules/expo-share-intent/plugin/build/ios/withIosShareExtensionConfig.js

i attach it here for others to use, but no guarantees: expo-share-intent+1.5.1.patch

i put this in my patches folder in the project directory and it is applied after yarn install and changes the file so it does not add the experimental build target stuff anymore.

and then i had to configure my eas.json like this: eas.json

and configure the local credentials.

with this combination i was able to build.

achorein commented 2 months ago

Many thanks for your hard work! i will take a look and make a PR with your fix.

achorein commented 2 months ago

@etienne678 all right you just removed all the experimental config injected by the plugin, is your share intent working on your test flight build ? i'm wondering if this experimental config is only required for expo 49 but not needed anymore. Maybe i should add an option in the plugin to disable experimental config.

etienne678 commented 2 months ago

yes it works for me in my test build