customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

iOS compile failed due to error UnhandledPromiseRejection in 3.6.0 #256

Closed Bob-MYMC closed 3 months ago

Bob-MYMC commented 3 months ago

SDK version: 3.6.0

Environment: Development and Production

Are logs available?

node:internal/process/promises:288 triggerUncaughtException(err, true /* fromPromise */); ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening meka.xcworkspace.".] { code: 'ERR_UNHANDLED_REJECTION' }

Describe the bug

After upgrade to 3.6.0, the iOS compile shows the error as above, I works with version is 3.5.2

To Reproduce

Expected behavior

Screenshots

image

Additional context

after removing the change on file project.pbxproj, the project can be compiled.

image

levibostian commented 3 months ago

Hey there. Sorry to hear that you encountered this issue.

From looking over everything that you have sent, this appears to me to be a cocoapods behavior and not a behavior caused by the Customer.io SDK. I believe that cocoapods made this modification to your project.pbxproj file that has caused this issue.

I am glad to hear that you are able to compile your project again after removing the change made to project.pbxproj. Because you are able to continue compiling your app, is there anything else I can help you with on this issue?

If you continue to encounter this problem and are able to provide a series of steps to reproduce this issue, feel free to send those steps over to us and we can dig into this deeper for you.

Have a great day!

Bob-MYMC commented 3 months ago

@levibostian Many Thanks for looking into this ticket.

It can be manually fixed on local mode, however the CI/CD flow is blocked atm. I have tried all the version from 3.5.2 to 3.6.0, the phase Copy Pods Resources is only added by version 3.6.0

Compare the main with 3.5.4 https://github.com/customerio/customerio-reactnative/compare/3.5.4...main

This phase can be found in the file Apps/APN/ios/SampleApp.xcodeproj/project.pbxproj

image
levibostian commented 3 months ago

That is helpful, thank you. The project.pbxproj may be modified because our latest version of the React Native SDK adds privacy manifest resource files. The diff screenshot in the description doesn't include any paths related to the SDK but the screenshots in your last comment does show paths related to these new resource files.

Could you try building your app with Xcode, by opening meka.xcworkspace and performing a build? If you get any errors, send them in a comment. Please be sure to include the entire error message. Sometimes screenshots in Xcode do not include the entire error message.

Bob-MYMC commented 3 months ago

Here is the error from Xcode: Same error from the CD flow

image

Build meka_2024-04-17T00-50-36.txt

levibostian commented 3 months ago

That error log is very helpful, thank you.

It looks a file permission issue for macOS. /usr/bin/sandbox-exec is trying to execute a script and that script is trying to write a new file to your Desktop but it does not have permission to do so.

I have personally not seen this error before but I wonder if this is caused by macOS restricting apps from writing files to your Desktop by default. If you move your codebase into a different folder (I personally use ~/code/) on your computer or you give file system permissions to Xcode, that may solve your issue.

Bob-MYMC commented 3 months ago

@levibostian Thanks for your suggestions. It finally works by this solution: https://stackoverflow.com/questions/76792138/sandbox-bash72986-deny1-file-write-data-users-xxx-ios-pods-resources-to-co

update your Xcode project build option 'ENABLE_USER_SCRIPT_SANDBOXING' to 'No'. image

levibostian commented 3 months ago

Glad to hear that you found a solution!

I'll close this issue since you have it working. Feel free to open new issues in the future. Have a great day!