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

Cordova + React: having a HARD time #307

Closed
igorsantos07 opened this issue Mar 31, 2023 · 4 comments
Closed

Cordova + React: having a HARD time #307

igorsantos07 opened this issue Mar 31, 2023 · 4 comments

Comments

@igorsantos07
Copy link

igorsantos07 commented Mar 31, 2023

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 getsentry/sentry-javascript#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

  • sentry-cordova 1.1.4 (which seems to depend on sentry/code 7.34.0
  • sentry-react used to be 7.38, but I downgraded to 7.34 in hopes to fix this issue, but wasn't yet able to confirm it works
  • cordova --version answers with 10.0.0
  • macOS 12.5.1

Extras

  • it seems your plugin.xml still lists the its version as 1.0.0-rc.0
  • sorry for not following the template, but as you can see, this is no simple bug, I had to "tell the story" first and the expectation is for it to simply compile, work fine, and be able to see somewhat decent reports on our Sentry dashboard :(
@kahest kahest assigned kahest and unassigned kahest Apr 3, 2023
@kahest kahest assigned kahest and unassigned kahest Apr 12, 2023
@github-actions
Copy link

github-actions bot commented May 4, 2023

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
Copy link
Collaborator

lucas-zimerman commented May 8, 2023

I'll take a look on what's going on, but yeah the versioning is wrong due to this issue #306 It should be fixed on te next version

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

@github-actions
Copy link

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
Copy link
Author

@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 :(

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

No branches or pull requests

3 participants