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]: pod install fails with wrong Service Extension plist file path in latest Expo SDK 50 beta #213

Closed
1 task done
chriszs opened this issue Nov 30, 2023 · 49 comments
Closed
1 task done

Comments

@chriszs
Copy link

chriszs commented Nov 30, 2023

What happened?

To prep for Expo SDK 50 and React Native 0.73, I upgraded to the latest Expo beta release, which includes React Native 0.73.0. When running prebuild with --clean, I get a failure with the message: "The plist file at path test-app/ios/OneSignalNotificationServiceExtension-Info.plist doesn't exist." The plist file does exist, but in the OneSignalNotificationServiceExtension directory under ios/, so the CocoaPods script is looking at the wrong path. This could well be a React Native or Expo bug, but something is breaking.

Steps to reproduce?

  1. npx create-expo-app test-app
  2. cd test-app
  3. npx expo prebuild
  4. npx expo install onesignal-expo-plugin react-native-onesignal
  5. In app.json, replace "onesignal-expo-plugin" with
    [
      "onesignal-expo-plugin",
      {
        "mode": "development"
      }
    ]
  1. npx expo prebuild --clean # completes successfully
  2. npm i expo@next
  3. npx expo install --fix
  4. npx expo prebuild --clean # fails

What did you expect to happen?

I expected the Cocoapod install to successfully complete.

OneSignal Expo SDK version

50.0.0-preview.0

Platform

iOS

Relevant log output

⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: An error occurred while processing the post-install hook of the Podfile.

[!] The plist file at path `/Users/admin/Desktop/test-app/ios/OneSignalNotificationServiceExtension-Info.plist` doesn't exist.


/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/xcodeproj-1.22.0/lib/xcodeproj/plist.rb:17:in `read_from_path'
/Users/admin/Desktop/test-app/node_modules/react-native/scripts/cocoapods/utils.rb:553:in `block in update_ats_in_plist'
/Users/admin/Desktop/test-app/node_modules/react-native/scripts/cocoapods/utils.rb:551:in `each'
/Users/admin/Desktop/test-app/node_modules/react-native/scripts/cocoapods/utils.rb:551:in `update_ats_in_plist'
/Users/admin/Desktop/test-app/node_modules/react-native/scripts/cocoapods/utils.rb:574:in `apply_ats_config'
/Users/admin/Desktop/test-app/node_modules/react-native/scripts/react_native_pods.rb:310:in `react_native_post_install'
/Users/admin/Desktop/test-app/ios/Podfile:57:in `block (3 levels) in from_ruby'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.12.1/lib/cocoapods-core/podfile.rb:196:in `post_install!'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:1013:in `run_podfile_post_install_hook'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:1001:in `block in run_podfile_post_install_hooks'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:149:in `message'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:1000:in `run_podfile_post_install_hooks'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:337:in `block (2 levels) in create_and_save_projects'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in `write!'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:336:in `block in create_and_save_projects'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/user_interface.rb:64:in `section'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:315:in `create_and_save_projects'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:307:in `generate_pods_project'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:183:in `integrate'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/installer.rb:170:in `install!'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/command/install.rb:52:in `run'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/lib/cocoapods/command.rb:52:in `run'
/Users/admin/.asdf/installs/ruby/2.7.6/lib/ruby/gems/2.7.0/gems/cocoapods-1.12.1/bin/pod:55:in `<top (required)>'
/Users/admin/.asdf/installs/ruby/2.7.6/bin/pod:23:in `load'
/Users/admin/.asdf/installs/ruby/2.7.6/bin/pod:23:in `<main>'

Code of Conduct

  • I agree to follow this project's Code of Conduct
@chriszs chriszs changed the title [Bug]: plist file path bug in latest Expo SDK 50 canary [Bug]: pod install fails with wrong ServiceExtension plist file path in latest Expo SDK 50 canary Nov 30, 2023
@chriszs chriszs changed the title [Bug]: pod install fails with wrong ServiceExtension plist file path in latest Expo SDK 50 canary [Bug]: pod install fails with wrong Service Extension plist file path in latest Expo SDK 50 canary Nov 30, 2023
@emawby
Copy link
Contributor

emawby commented Dec 4, 2023

Thank you for the investigation that is very helpful. We are looking into this

@chriszs
Copy link
Author

chriszs commented Dec 5, 2023

Sure! It might just go away, but then again it might not and this is probably the last chance to pick a fix for 0.73 and we're going to be in SDK 50 betas soon after.

@chriszs chriszs changed the title [Bug]: pod install fails with wrong Service Extension plist file path in latest Expo SDK 50 canary [Bug]: pod install fails with wrong Service Extension plist file path in latest Expo SDK 50 beta Dec 12, 2023
@chriszs
Copy link
Author

chriszs commented Dec 12, 2023

Still happening with the released React Native 0.73 and Expo SDK 50 beta.

@MoamberRaza
Copy link

still happening always have to delete targets or provide base info.plist path then pod install then reassign original.

@sapkotamadhusudan
Copy link

I've written a patch that fixes the pod install issue.
I'm still in the middle of migrating my project to expo SDK 50, so haven't tested out the functionality yet
Hope this helps

diff --git a/node_modules/onesignal-expo-plugin/build/onesignal/withOneSignalIos.js b/node_modules/onesignal-expo-plugin/build/onesignal/withOneSignalIos.js
index 51af3d1..1784fd9 100644
--- a/node_modules/onesignal-expo-plugin/build/onesignal/withOneSignalIos.js
+++ b/node_modules/onesignal-expo-plugin/build/onesignal/withOneSignalIos.js
@@ -103,7 +103,7 @@ const withOneSignalPodfile = (config) => {
         async (config) => {
             // not awaiting in order to not block main thread
             const iosRoot = path.join(config.modRequest.projectRoot, "ios");
-            (0, updatePodfile_1.updatePodfile)(iosRoot).catch(err => { OneSignalLog_1.OneSignalLog.error(err); });
+            await (0, updatePodfile_1.updatePodfile)(iosRoot).catch(err => { OneSignalLog_1.OneSignalLog.error(err); });
             return config;
         },
     ]);
@@ -146,7 +146,7 @@ const withOneSignalXcodeProject = (config, props) => {
             return newConfig;
         }
         // Create new PBXGroup for the extension
-        const extGroup = xcodeProject.addPbxGroup([...iosConstants_1.NSE_EXT_FILES, iosConstants_1.NSE_SOURCE_FILE], iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME);
+        const extGroup = xcodeProject.addPbxGroup([...iosConstants_1.NSE_EXT_FILES.map((it)=> path.join(iosConstants_1.NSE_TARGET_NAME, it)), iosConstants_1.NSE_SOURCE_FILE], iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME);
         // Add the new PBXGroup to the top level group. This makes the
         // files / folder appear in the file explorer in Xcode.
         const groups = xcodeProject.hash.project.objects["PBXGroup"];
diff --git a/node_modules/onesignal-expo-plugin/onesignal/withOneSignalIos.ts b/node_modules/onesignal-expo-plugin/onesignal/withOneSignalIos.ts
index 590679d..fb4f83b 100644
--- a/node_modules/onesignal-expo-plugin/onesignal/withOneSignalIos.ts
+++ b/node_modules/onesignal-expo-plugin/onesignal/withOneSignalIos.ts
@@ -108,7 +108,7 @@ const withOneSignalPodfile: ConfigPlugin<OneSignalPluginProps> = (config) => {
     async config => {
       // not awaiting in order to not block main thread
       const iosRoot = path.join(config.modRequest.projectRoot, "ios")
-      updatePodfile(iosRoot).catch(err => { OneSignalLog.error(err) });
+      await updatePodfile(iosRoot).catch(err => { OneSignalLog.error(err) });
 
       return config;
     },
@@ -160,7 +160,7 @@ const withOneSignalXcodeProject: ConfigPlugin<OneSignalPluginProps> = (config, p
     }
 
     // Create new PBXGroup for the extension
-    const extGroup = xcodeProject.addPbxGroup([...NSE_EXT_FILES, NSE_SOURCE_FILE], NSE_TARGET_NAME, NSE_TARGET_NAME);
+    const extGroup = xcodeProject.addPbxGroup([...NSE_EXT_FILES.map((it)=> path.join(NSE_TARGET_NAME, it)), NSE_SOURCE_FILE], NSE_TARGET_NAME, NSE_TARGET_NAME);
 
     // Add the new PBXGroup to the top level group. This makes the
     // files / folder appear in the file explorer in Xcode.

@andrew-levy
Copy link

Hey there. I maintain a config plugin and am running into a similar issue andrew-levy/react-native-safari-extension#24. Has anyone looked into this yet? Thanks.

@chriszs
Copy link
Author

chriszs commented Jan 9, 2024

I applied @sapkotamadhusudan's patch by hand and it does allow prebuild to complete successfully, though I'm not 100% sure whether the await is needed. Probably needs some adaption for backwards compatibility, but could form the basis of a PR.

@sapkotamadhusudan
Copy link

@chriszs i think i did added await because of onesignal extension was not added on podfile in my project.

@andrew-levy
Copy link

@sapkotamadhusudan can you please explain your patch?

@chriszs
Copy link
Author

chriszs commented Jan 11, 2024

Okay, so after further investigation: seems like there is a bug in the latest version of React Native (but they closed that issue due to lack of reproduction). Evan Bacon commented extensively on the PR which added the breaking change with specifics on how to fix it after it was merged. Here's an attempt at a patch. Going to keep digging, but I think this should eventually be an upstream patch. Could be worked around in this package, though, in the meantime.

@chriszs
Copy link
Author

chriszs commented Jan 11, 2024

Created a minimal reproduction and filed a new upstream issue.

hyochan added a commit to hyochan/onesignal-expo-plugin that referenced this issue Jan 20, 2024
@hyochan hyochan mentioned this issue Jan 20, 2024
8 tasks
@hyochan
Copy link

hyochan commented Jan 20, 2024

I've created temperary fixes in #220. You can use this with below dependencies.

"onesignal-expo-plugin": "git+https://github.com/hyochan/onesignal-expo-plugin.git#build",

@comontes
Copy link

I've created temperary fixes in #213. You can use this with below dependencies.

"onesignal-expo-plugin": "git+https://github.com/hyochan/onesignal-expo-plugin.git#build",

Thanks, but I get this error when adding the dependency:

$ yarn run build
yarn run v1.22.19
warning ../../../../../../package.json: No license field
$ yarn run lint && rm -rf build && tsc && cp -a support/serviceExtensionFiles build/support/
warning ../../../../../../package.json: No license field
$ eslint . --ext .ts

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignal.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignal.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignalAndroid.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignalAndroid.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignalIos.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignalIos.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/FileManager.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/FileManager.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/NseUpdaterManager.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/NseUpdaterManager.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/OneSignalLog.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/OneSignalLog.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/eas/getEasManagedCredentialsConfigExtra.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/eas/getEasManagedCredentialsConfigExtra.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/helpers.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/helpers.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/iosConstants.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/iosConstants.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/updatePodfile.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/updatePodfile.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/types/types.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: types/types.ts.
The file must be included in at least one of the projects provided

✖ 11 problems (11 errors, 0 warnings)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

@hyochan
Copy link

hyochan commented Jan 21, 2024

I've created temperary fixes in #220. You can use this with below dependencies.

"onesignal-expo-plugin": "git+https://github.com/hyochan/onesignal-expo-plugin.git#build",

Thanks, but I get this error when adding the dependency:

$ yarn run build
yarn run v1.22.19
warning ../../../../../../package.json: No license field
$ yarn run lint && rm -rf build && tsc && cp -a support/serviceExtensionFiles build/support/
warning ../../../../../../package.json: No license field
$ eslint . --ext .ts

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignal.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignal.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignalAndroid.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignalAndroid.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignalIos.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignalIos.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/FileManager.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/FileManager.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/NseUpdaterManager.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/NseUpdaterManager.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/OneSignalLog.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/OneSignalLog.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/eas/getEasManagedCredentialsConfigExtra.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/eas/getEasManagedCredentialsConfigExtra.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/helpers.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/helpers.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/iosConstants.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/iosConstants.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/updatePodfile.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/updatePodfile.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/types/types.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: types/types.ts.
The file must be included in at least one of the projects provided

✖ 11 problems (11 errors, 0 warnings)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Try to reset the cache and run expo prebuild after installing packages.

@ansh
Copy link

ansh commented Jan 22, 2024

I'm facing this issue too and the patch created by @hyochan fixed it!

@hasanaktas
Copy link

I've created temperary fixes in #220. You can use this with below dependencies.

"onesignal-expo-plugin": "git+https://github.com/hyochan/onesignal-expo-plugin.git#build",

Thanks, but I get this error when adding the dependency:

$ yarn run build
yarn run v1.22.19
warning ../../../../../../package.json: No license field
$ yarn run lint && rm -rf build && tsc && cp -a support/serviceExtensionFiles build/support/
warning ../../../../../../package.json: No license field
$ eslint . --ext .ts

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignal.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignal.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignalAndroid.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignalAndroid.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/onesignal/withOneSignalIos.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: onesignal/withOneSignalIos.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/FileManager.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/FileManager.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/NseUpdaterManager.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/NseUpdaterManager.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/OneSignalLog.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/OneSignalLog.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/eas/getEasManagedCredentialsConfigExtra.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/eas/getEasManagedCredentialsConfigExtra.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/helpers.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/helpers.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/iosConstants.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/iosConstants.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/support/updatePodfile.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: support/updatePodfile.ts.
The file must be included in at least one of the projects provided

/Users/carl/Library/Caches/Yarn/v6/.tmp/fd9865e7ff1e3c2f46fbc9f1a1d4c15e.1b7ea96fb016b7d555c14ac99aec79b620149db5.prepare/types/types.ts
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: types/types.ts.
The file must be included in at least one of the projects provided

✖ 11 problems (11 errors, 0 warnings)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Try to reset the cache and run expo prebuild after installing packages.

I build with eas build local without prebuild. I get the same error when installing your package. How can I solve it?

@hyochan
Copy link

hyochan commented Jan 22, 2024

@hasanaktas Try to reset caches and remove node_modules and reinstall it. Also I am not sure why you have problem with expo prebuild. I am also using eas local build.

@themtaysw
Copy link

Even after SDK 50 stable release, still happening

[!] An error occurred while processing the post-install hook of the Podfile.

[!] The plist file at path `/Users/User/Desktop/app/ios/OneSignalNotificationServiceExtension-Info.plist` doesn't exist.

@fran-cadenas-fu
Copy link

I'm also getting this problem and it got fixed with @hyochan 's fix. Hope this get solved so we can point back to official repo!

@domodu-apps
Copy link

I couldn't get the fix by @hyochan to work, I'm just using EAS build, with no local prebuild. Maybe that's why. I just switched to expo-notifications, maybe I'll try OneSignal again in the future

@wilkinsonj
Copy link

I get the same problem hasanaktas does. On both EAS build and local build. It's not a problem with the fix, its a problem with including github links in packages.json, I'm not sure why.

@tcaish
Copy link

tcaish commented Jan 25, 2024

Same problem after trying to upgrade to Expo SDK 50 and using EAS Build.

@hasanaktas
Copy link

I get the same problem hasanaktas does. On both EAS build and local build. It's not a problem with the fix, its a problem with including github links in packages.json, I'm not sure why.

Did you find a solution?

@chriszs
Copy link
Author

chriszs commented Jan 29, 2024

This should be fixed in React Native 0.73.3 when that's released.

@andrew-levy
Copy link

@chriszs MVP. thanks!

@anirudhsama
Copy link

React Native 0.73.3 is released and the fix is no longer needed. Release 2.0.2 works.

@chriszs
Copy link
Author

chriszs commented Jan 30, 2024

@andrew-levy Don't thank me! Thank Gabriel Donadel, who removed the offending method for separate reasons (it was a poorly thought out addition on multiple levels) and is also working on the PR for upgrading 0.73.3 in Expo.

Presumably that'll land and be published soon.

@hasanaktas
Copy link

@anirudhsama @chriszs

Are you sure the error has been resolved? I still can't get the build for iOS.
I get the same error both on my own computer and on the expo servers.

local : eas build --profile production --platform ios --local --output ./builds/production.ipa

expo-server : eas build --profile production --platform ios

"expo": "~50.0.5"
"react-native": "0.73.2"
"react-native-onesignal": "^5.0.5"
"onesignal-expo-plugin": "^2.0.2"

[ 'onesignal-expo-plugin', { mode: 'production', iPhoneDeploymentTarget: '13.0', }, ]

error message

[INSTALL_PODS] [!] CocoaPods could not find compatible versions for pod "OneSignalXCFramework":
[INSTALL_PODS] In Podfile:
[INSTALL_PODS] OneSignalXCFramework (< 6.0, >= 5.0)
[INSTALL_PODS] react-native-onesignal (from ../node_modules/react-native-onesignal) was resolved to 5.0.5, which depends on
[INSTALL_PODS] OneSignalXCFramework (= 5.1.0)
[INSTALL_PODS] Specs satisfying the OneSignalXCFramework (< 6.0, >= 5.0), OneSignalXCFramework (= 5.1.0) dependency were found, but they required a higher minimum deployment target.
[INSTALL_PODS] [!] <PBXResourcesBuildPhase UUID=13B07F8E1A680F5B00A75B9A> attempted to initialize an object with an unknown UUID. BA9E03587B4142299F291090 for attribute: files. This can be the result of a merge and the unknown UUID is being discarded.
[INSTALL_PODS]
Error: pod install exited with non-zero code: 1
at ChildProcess.completionListener (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23)
at Object.onceWrapper (node:events:629:26)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5)
...
at spawnAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)
at spawn (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/turtle-spawn/dist/index.js:16:47)
at installPods (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/ios/pod.js:11:38)
at /Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:69:41
at BuildContext.runBuildPhase (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/context.js:98:34)
at buildAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:68:19)
at async runBuilderWithHooksAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/common.js:12:13)
at async Object.iosBuilder (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:28:16)
at async buildIosAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/eas-cli-local-build-plugin/dist/ios.js:66:12)
at async buildAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/eas-cli-local-build-plugin/dist/build.js:56:29)

@comontes
Copy link

comontes commented Feb 1, 2024

@anirudhsama @chriszs

Are you sure the error has been resolved? I still can't get the build for iOS.

I get the same error both on my own computer and on the expo servers.

local : eas build --profile production --platform ios --local --output ./builds/production.ipa

expo-server : eas build --profile production --platform ios

"expo": "~50.0.5"

"react-native": "0.73.2"

"react-native-onesignal": "^5.0.5"

"onesignal-expo-plugin": "^2.0.2"

`[

        'onesignal-expo-plugin',

        {

            mode: 'production',

            iPhoneDeploymentTarget: '13.0',

        },

]`

error message

[INSTALL_PODS] [!] CocoaPods could not find compatible versions for pod "OneSignalXCFramework":

[INSTALL_PODS] In Podfile:

[INSTALL_PODS] OneSignalXCFramework (< 6.0, >= 5.0)

[INSTALL_PODS] react-native-onesignal (from ../node_modules/react-native-onesignal) was resolved to 5.0.5, which depends on

[INSTALL_PODS] OneSignalXCFramework (= 5.1.0)

[INSTALL_PODS] Specs satisfying the OneSignalXCFramework (< 6.0, >= 5.0), OneSignalXCFramework (= 5.1.0) dependency were found, but they required a higher minimum deployment target.

[INSTALL_PODS] [!] <PBXResourcesBuildPhase UUID=13B07F8E1A680F5B00A75B9A> attempted to initialize an object with an unknown UUID. BA9E03587B4142299F291090 for attribute: files. This can be the result of a merge and the unknown UUID is being discarded.

[INSTALL_PODS]

Error: pod install exited with non-zero code: 1

at ChildProcess.completionListener (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23)

at Object.onceWrapper (node:events:629:26)

at ChildProcess.emit (node:events:514:28)

at maybeClose (node:internal/child_process:1105:16)

at ChildProcess._handle.onexit (node:internal/child_process:305:5)

...

at spawnAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)

at spawn (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/turtle-spawn/dist/index.js:16:47)

at installPods (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/ios/pod.js:11:38)

at /Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:69:41

at BuildContext.runBuildPhase (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/context.js:98:34)

at buildAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:68:19)

at async runBuilderWithHooksAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/common.js:12:13)

at async Object.iosBuilder (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:28:16)

at async buildIosAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/eas-cli-local-build-plugin/dist/ios.js:66:12)

at async buildAsync (/Users/hasanaktas/.npm/_npx/994d822063d9f19d/node_modules/eas-cli-local-build-plugin/dist/build.js:56:29)

Have you tried react-native 0.73.3? that is the version that is supposed to work(I haven't tried yet)

@hasanaktas
Copy link

@comontes

package.json

 "react-native": "0.73.3"
 "expo": {
        "install": {
            "exclude": [
                "react-native"
            ]
        }
    }

Yes, I tried upgrading and the same error persisted.

@chriszs
Copy link
Author

chriszs commented Feb 1, 2024

@hasanaktas That appears to be a separate error and error message. The one described here is fixed in 0.73.3. Confirmed by upgrading the minimal reproduction I created to file the upstream issue. Keeping this issue open until Expo integrates 0.73.3, because this is an Expo plugin.

@ChromeQ
Copy link

ChromeQ commented Feb 2, 2024

Confirming that upgrade to react-native 0.73.3 works for iOS build using onesignal-expo-plugin

@ansh
Copy link

ansh commented Feb 2, 2024

@ChromeQ which version of Expo are you running? I don't see one that is compatible with 0.73.3 of Rn

@ChromeQ
Copy link

ChromeQ commented Feb 2, 2024

Latest expo@50.0.5, it isn't "officially" compatible, but the workaround mentioned above is the way to tell expo to not worry about the react-native version:

package.json

 "react-native": "0.73.3"
 "expo": {
        "install": {
            "exclude": [
                "react-native"
            ]
        }
    }

I'll work with this until expo update allows react-native@0.73.3

@ChromeQ
Copy link

ChromeQ commented Feb 2, 2024

Using this actually exposes another issue which is mentioned here: RCTBridge required dispatch_sync to load RCTAccessibilityManager. This may lead to deadlocks #42728

Perhaps the better solution for now is a more targeted patch and persist it using patch-package - will investigate and report back

@ChromeQ
Copy link

ChromeQ commented Feb 2, 2024

Further update:
To avoid the RCTBridge issue above with using react-native 0.73.3, I tried to apply the fix by @hyochan and use patch-package to preserve the changes.

However, running the build on expo Build did not work (perhaps it would for local machine but I am not on a mac). This is because expo Build runs prebuild before yarn install from what I can tell from logs...
Screenshot_20240202-144320
So having the patch package run after prebuild is not going to do anything.

My solution was a bit more manual, I added the following bash script to the package.json postinstall script:

"postinstall": "patch-package && if [ -f \"ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist\" ]; then cp ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist ios/; fi"

By the way, patch-package is not required and you don't need the patch as outlined by @hyochan, I already had patch package as part of my postinstall script but you can do it without too.

Hope this helps until some upstream dependencies are usable

@chriszs
Copy link
Author

chriszs commented Feb 2, 2024

Seems like a good use for @Kudo's new experimental patch-project for Expo SDK 50, which is patch-package as a Prebuild plugin. Here's what I did:

  1. npx expo install patch-project
  2. Added 'patch-project', to my app.config.ts plugins.
  3. cp ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist ios/OneSignalNotificationServiceExtension-Info.plist
  4. npx patch-project
  5. Then I did a bunch of manual wrangling to produce a patch file that matched what I wanted to do in /cng-patches, because the default behavior didn't pick up the new file.
  6. npx expo prebuild

@ChromeQ
Copy link

ChromeQ commented Feb 2, 2024

Interesting, I didn't know about patch-project but I will keep an eye on it! Although the "bunch of manual wrangling to produce a patch file that matched what I wanted to do" kinda defeats the purpose so I'll pass for now as I hope this is a short term fix.

@karlqueckfeldt
Copy link

Latest expo@50.0.5, it isn't "officially" compatible, but the workaround mentioned above is the way to tell expo to not worry about the react-native version:

package.json

 "react-native": "0.73.3"
 "expo": {
        "install": {
            "exclude": [
                "react-native"
            ]
        }
    }

I'll work with this until expo update allows react-native@0.73.3

That doesn't look like valid json. How and where do you enter this in the package.json file? I'm experiencing the same issue as OP.

@ChromeQ
Copy link

ChromeQ commented Feb 5, 2024

Latest expo@50.0.5, it isn't "officially" compatible, but the workaround mentioned above is the way to tell expo to not worry about the react-native version:

package.json

 "react-native": "0.73.3"
 "expo": {
        "install": {
            "exclude": [
                "react-native"
            ]
        }
    }

I'll work with this until expo update allows react-native@0.73.3

That doesn't look like valid json. How and where do you enter this in the package.json file? I'm experiencing the same issue as OP.

@karlqueckfeldt It's just parts of the json, the "react-native": "0.73.3" is the version listed under dependencies. The "expo" object goes at the root.

However, I don't recommend this as I tried it and react-native@0.73.3 comes with another bug as mentioned in this issue: facebook/react-native#42728

@karlqueckfeldt
Copy link

Latest expo@50.0.5, it isn't "officially" compatible, but the workaround mentioned above is the way to tell expo to not worry about the react-native version:

package.json

 "react-native": "0.73.3"
 "expo": {
        "install": {
            "exclude": [
                "react-native"
            ]
        }
    }

I'll work with this until expo update allows react-native@0.73.3

That doesn't look like valid json. How and where do you enter this in the package.json file? I'm experiencing the same issue as OP.

@karlqueckfeldt It's just parts of the json, the "react-native": "0.73.3" is the version listed under dependencies. The "expo" object goes at the root.

However, I don't recommend this as I tried it and react-native@0.73.3 comes with another bug as mentioned in this issue: facebook/react-native#42728

Ah, I see. Thanks! Noted.

@ChromeQ
Copy link

ChromeQ commented Feb 5, 2024

@karlqueckfeldt If you need a solution to work today then my solution will get you there until react-native 0.73.3 is supported in expo:

My solution was a bit more manual, I added the following bash script to the package.json postinstall script:

"postinstall": "patch-package && if [ -f \"ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension->Info.plist\" ]; then cp ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist ios/; fi"

By the way, patch-package is not required and you don't need the patch as outlined by @hyochan, I already had patch package as part of my postinstall script but you can do it without too.

You should remove the patch-package && if you don't use patch-package. Let me know if this works out for you

@karlqueckfeldt
Copy link

karlqueckfeldt commented Feb 6, 2024

@karlqueckfeldt If you need a solution to work today then my solution will get you there until react-native 0.73.3 is supported in expo:

My solution was a bit more manual, I added the following bash script to the package.json postinstall script:

"postinstall": "patch-package && if [ -f \"ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension->Info.plist\" ]; then cp ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist ios/; fi"

By the way, patch-package is not required and you don't need the patch as outlined by @hyochan, I already had patch package as part of my postinstall script but you can do it without too.

You should remove the patch-package && if you don't use patch-package. Let me know if this works out for you

Thanks for the tip! Unfortunately, this makes my CocoaPods install fail. I cleared my node_modules folder, and ran npm install after adding the postinstall script.

⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: An error occurred while processing the post-install hook of the Podfile.

[!] The plist file at path `/Users/[USER]/Projects/[PROJECT]/app/ios/OneSignalNotificationServiceExtension-Info.plist` doesn't exist.

EDIT: I think it was because the script had an error in it. The ->Info.plis part, should just be -Info.plist no?

Your script:

"postinstall": "patch-package && if [ -f \"ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension->Info.plist\" ]; then cp ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist ios/; fi"

My change (also without patch-package):

"postinstall": " if [ -f \"ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist\" ]; then cp ios/OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist ios/; fi"

@ChromeQ
Copy link

ChromeQ commented Feb 6, 2024

Yep that will be it! I typed it out on my mobile so it was a typo/autocorrect.
Let me know if it works after removing the >

@karlqueckfeldt
Copy link

Yep that will be it! I typed it out on my mobile so it was a typo/autocorrect. Let me know if it works after removing the >

Works great! Thanks 🌟

@bensaine
Copy link

bensaine commented Feb 6, 2024

Just FYI, expo now bumped RN to 0.73.4 expo/expo#26774, so this should be fixed !

@ansh
Copy link

ansh commented Feb 6, 2024

@bensaine Have they released a new version of Expo with that yet?

@bensaine
Copy link

bensaine commented Feb 6, 2024

@bensaine Have they released a new version of Expo with that yet?

Running npx expo install --fix should do the trick. You should see RN 0.73.4 in your package.json after that.

@chriszs
Copy link
Author

chriszs commented Feb 7, 2024

Works for me.

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

No branches or pull requests