getsentry / sentry-cordova

The official Sentry SDK for Cordova
https://sentry.io/
MIT License
68 stars 55 forks source link

Cordova + React: having a HARD time #307

Closed igorsantos07 closed 11 months ago

igorsantos07 commented 1 year ago

We've got a React app which both runs on the web browser and inside a Cordova shell. We included Sentry in both sides, but initially I was facing an error similar to https://github.com/getsentry/sentry-javascript/issues/2622. The suggestion there was to make sure dependencies on both sides match, since this Cordova package is a bit outdated.

I'm back to the topic and I'm not really sure what's going on, since cordova-cli behaves weirdly and, in the end, I'm not able to properly compile my app. Before my new actions, my package.json only had an empty object at cordova.plugins.sentry-cordova. No other mentions, besides the usual sentry.properties file.

Then, after a bunch of back and forth between npx cordova rm sentry-cordova and re-adding it to try to get the correct versions, I'm stuck with the same "consistent/broken" results, as follows:

  1. sentry is not present in package.json nor lockfile, and there's no sentry.properties
  2. npx cordova add sentry-cordova:

    Failed to fetch plugin sentry-cordova via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. CordovaError: CordovaError: Could not determine package name from output:

  3. npx cordova add sentry-cordova again, right after the error above: works fine, with that very cool wizard asking which project from Sentry I want to link this install to. It says it installed version 1.4.0, with sentry-cli v1.75.0. The version inside package.json is ^1.1.4, and cordova.plugins.sentry-cordova now includes SENTRY_ANDROID_SDK_VERSION: 6.11.0. No clue what I did before that didn't include those details, but I can swear I just ran whatever is instructed in the docs - which is, you guessed, cordova plugin add sentry-cordova, the same I did. However, while trying to fix versions I have also run cordova plugin add sentry-cordova@1.1.4, so I wonder if since then it's always finding this "correct"(?) version and installing it all correctly... One thing I noticed, though, is that there's no entry for sentry-cordova at my project's config.xml šŸ¤” Adding it manually makes no difference on the next step, though.
  4. well, then I try to run the project and it fails, complaining about target version mismatches, right after some sort of "framework patching":

    relevant(?) part from console output
        [...]
        export _WRAPPER_RESOURCES_DIR_SHALLOW_BUNDLE_NO\=/Resources
        export __IS_NOT_MACOS\=YES
        export __IS_NOT_MACOS_macosx\=NO
        export __IS_NOT_SIMULATOR\=YES
        export __IS_NOT_SIMULATOR_simulator\=NO
        export arch\=undefined_arch
        export diagnostic_message_length\=152
        export variant\=normal
        /bin/sh -c /Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/IntermediateBuildFilesPath/[[redacted]].build/Debug-iphoneos/[[redacted]].build/Script-E86B4C21FBB84FB7ABBE93B1.sh
    warning: patching framework - set SENTRY_SKIP_FRAMEWORK_PATCH=true to skip this
    Executable is /Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/InstallationBuildProductsLocation/Applications/[[redacted]].app/Frameworks/Sentry.framework/Sentry
    Extracting arm64 from Sentry
    fatal error: lipo: input file (/Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/InstallationBuildProductsLocation/Applications/[[redacted]].app/Frameworks/Sentry.framework/Sentry) must be a fat file when the -extract option is specified
    Merging extracted architectures: arm64
    fatal error: lipo: can't open input file: /Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/InstallationBuildProductsLocation/Applications/[[redacted]].app/Frameworks/Sentry.framework/Sentry-arm64 (No such file or directory)
    rm: /Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/InstallationBuildProductsLocation/Applications/[[redacted]].app/Frameworks/Sentry.framework/Sentry-arm64: No such file or directory
    Replacing original executable with thinned version
    mv: rename /Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/InstallationBuildProductsLocation/Applications/[[redacted]].app/Frameworks/Sentry.framework/Sentry-merged to /Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/InstallationBuildProductsLocation/Applications/[[redacted]].app/Frameworks/Sentry.framework/Sentry: No such file or directory
    Command PhaseScriptExecution failed with a nonzero exit code
    
    /Users/igoru/dev/app/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'Firebase' from project 'Pods')
    /Users/igoru/dev/app/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'Protobuf' from project 'Pods')
    /Users/igoru/dev/app/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleDataTransport' from project 'Pods')
    /Users/igoru/dev/app/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleUtilities' from project 'Pods')
    ** ARCHIVE FAILED **
    
    The following build commands failed:
        PhaseScriptExecution Sentry\ strip\ unused\ archs\ from\ Framework /Users/igoru/Library/Developer/Xcode/DerivedData/[[redacted]]-cwcyzzhkusboogbrrawkubqtvsht/Build/Intermediates.noindex/ArchiveIntermediates/[[redacted]]/IntermediateBuildFilesPath/[[redacted]].build/Debug-iphoneos/[[redacted]].build/Script-E86B4C21FBB84FB7ABBE93B1.sh (in target '[[redacted]]' from project '[[redacted]]')
    (1 failure)
    
  5. then I try to remove the plugin via npx cordova plugin rm sentry-cordova, which fails in the Sentry Wizard (does it expect to be uninstalled?):

    Sentry uninstall output
    Sentry: running before_plugin_rm - set SENTRY_SKIP_WIZARD=true to skip this
    Sentry: removing sentry.properties
    no URL provided, fallback to https://sentry.io/
    Running Sentry Wizard...
    version: 1.4.0 | sentry-cli version: 1.75.0
    
    Sentry Wizard failed with:
    undefined
    
    Protip: Add --debug to see whats going on
    OR use --help to see your options
    Uninstalling sentry-cordova from android
    Subproject Path: CordovaLib
    Subproject Path: app
    Uninstalling sentry-cordova from ios
    Removing "sentry-cordova"
    Removing sentry-cordova from package.json
  6. rinse and repeat

Environment

Extras

github-actions[bot] commented 1 year ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ā€• Ella Wheeler Wilcox šŸ„€

lucas-zimerman commented 1 year ago

I'll take a look on what's going on, but yeah the versioning is wrong due to this issue https://github.com/getsentry/sentry-cordova/issues/306 It should be fixed on te next version

EDIT: Are you using an Mac device with ARM processor?

github-actions[bot] commented 11 months ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ā€• Ella Wheeler Wilcox šŸ„€

igorsantos07 commented 10 months ago

@lucas-zimerman, I stepped away for some time, but finally came back to this. Indeed, the reported problem seems fixed! However, there's still #311 which is causing trouble with compiling and further blocks deployment to iTunes Connect :(