sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

Using `upload-dif` results in Serde("missing field `CFBundleName`")

Open artur-zaremba opened this issue 2 years ago • 10 comments

Environment

macOS 12.4 Xcode 13.4.1, iOS app for min iOS 13 sentry-cli 2.5.0 installed via homebrew

Steps to reproduce

sentry-cli upload-dif -o ORG -p PROJECT --wait --log-level=debug ./AppName.app.dSYM.zip

Expected Result

Debug information files uploaded to Sentry.

Actual Result

error: Could not parse Info.plist file caused by: Serde("missing field CFBundleName")

artur-zaremba avatar Jul 27 '22 13:07 artur-zaremba

Also, I have found similar but resolved issues:

https://github.com/getsentry/sentry-cli/issues/895 https://github.com/getsentry/sentry-cli/issues/845 https://github.com/getsentry/sentry-cli/issues/48 https://github.com/getsentry/sentry-cli/issues/1093 https://github.com/getsentry/sentry-fastlane-plugin/issues/127

I want to use sentry plugin fastlane for uploading debug symbols via Using App Store Connect which seems more interesting for me because there is no need to wait for build processing. But I can't run the solution out of the box. Is there some workaround to use it? https://docs.sentry.io/platforms/apple/guides/ios/dsym/#bitcode-appstore https://docs.sentry.io/platforms/apple/guides/ios/dsym/#symbolmap-fastlane

artur-zaremba avatar Jul 27 '22 14:07 artur-zaremba

Seems that sentry_upload_dsym fastlane action also don't work in the same environment, I see the same error 😞

artur-zaremba avatar Jul 27 '22 14:07 artur-zaremba

Regarding link in Sentry https://betterprogramming.pub/info-plist-is-missing-in-xcode-13-heres-how-to-get-it-back-1a7abf3e2514 I have Info.plist in my project

artur-zaremba avatar Jul 27 '22 14:07 artur-zaremba

Hey @artur-zaremba I've encountered the same issue when using fastlane plugin. What helped me was to copy & paste all bundle related information from the "autogenerated" Info.plist (I am using this "semi sync" approach) into the new local file. Now my "local" Info.plist file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundleVersion</key>
	<string>$(CURRENT_PROJECT_VERSION)</string>
	<key>CFBundleShortVersionString</key>
	<string>$(MARKETING_VERSION)</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
</dict>
</plist>

This sill feels like a workaround rather then a real solution but at least it unblocked me.

fzymek avatar Aug 03 '22 06:08 fzymek

Thanks @fzymek, seems like it doesn't work without a workaround, that is why I summarised the issue from other closed issues. Seems like Sentry devs don't see it as a problem

artur-zaremba avatar Aug 03 '22 09:08 artur-zaremba

cc @philipphofmann @marandaneto @bruno-garcia

kamilogorek avatar Aug 04 '22 11:08 kamilogorek

@brustolin is working on iOS, ideas?

marandaneto avatar Aug 04 '22 12:08 marandaneto

Im not familiar with sentry-cli. I would need to investigate this a little bit.

@artur-zaremba Any minimum repro would be very helpful

brustolin avatar Aug 04 '22 13:08 brustolin

Any new Xcode project should suffice as a repro, as the issue will be there by default. The actual Info.plist on disk won't have the usual bundle display name, version and so on, however these will still be visible in Xcode itself. The Info.plist file might also not even exist by default anymore, until you fill in some of the data in Xcode, and/or create the file and provide the path to it in Xcode.

As to potential workarounds or fixes, it would be a matter of finding and parsing the right data from the right file, which I'm assuming would be the project file, but not entirely sure as I haven't delved too deep into this recent(ish) change.

By the looks of things, Apple is trying to get rid of Info.plist entirely, which will undoubtedly break a lot of 3rd party functionality, automation etc.

Dids avatar Aug 04 '22 14:08 Dids

Hi, I have the same problem in a new project created with Xcode 13.3.1, for Min target iOS 14

What fzymek suggested did not work for me, but this did

	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundleVersion</key>
	<string>$(CURRENT_PROJECT_VERSION)</string>
	<key>CFBundleShortVersionString</key>
	<string>$(MARKETING_VERSION)</string>

Include CFBundlePackageType and CFBundleExecutable still show the error 🤔

danielrobleM avatar Aug 12 '22 20:08 danielrobleM

Sounds like the new xcode doesn't create the info.plist file containing the information we need (e.g CFBundleName).

Is the bundle name anywhere to be found? We can ask @kamilogorek for help in changing sentry-cli to parse the right file but he'll need help getting a repro. @brustolin is this something you can help out with?

bruno-garcia avatar Aug 15 '22 18:08 bruno-garcia

Sounds like the new xcode doesn't create the info.plist file containing the information we need (e.g CFBundleName).

Yes, thats true.

Is the bundle name anywhere to be found?

Yes. PROJECT_NAME.xcodeproj/project.pbxproj contains the following line: PRODUCT_BUNDLE_IDENTIFIER = com.sample.bundle_id;

But this line appears once for each environment (debug, release, ...). I dont see why someone would use different values but this is something to keep in mind.

@kamilogorek can you help us out to update sentry-cli?

brustolin avatar Aug 16 '22 08:08 brustolin

It's important to fall back to the old plist file if the new property isn't available, because not everyone is using the latest Xcode projects nor Hybrid SDKs such as Flutter/RN upgrades them so often. I'd also double-check if the bundle identifier is the only one, might have to check some other ones too.

marandaneto avatar Aug 16 '22 09:08 marandaneto

It's important to fall back to the old plist file if the new property isn't available

I think the plist should be the default tbh, I believe plist have priority over the project value.

brustolin avatar Aug 16 '22 09:08 brustolin

Well, funny enough I cannot repro this issue with a fresh project on the same xcode version ¯_(ツ)_/¯

PRODUCT_BUNDLE_IDENTIFIER = com.sample.bundle_id;

We already fall back to those values in some cases, but it's unclear what code path is taken in the OPs case. Would be great if I could get a repro.

kamilogorek avatar Aug 16 '22 09:08 kamilogorek

I also could not repro this. @artur-zaremba can you help us providing a minimum sample?

brustolin avatar Aug 16 '22 12:08 brustolin

I have just created new project, added SPM library and added initialization code in AppDelegate.swift. Then I uploaded it to TestFlight, downloaded dSYM and tried upload it via sentry-cli upload-dif - the error is the same. I have sent you invite to the project, please check @brustolin

artur-zaremba avatar Aug 16 '22 13:08 artur-zaremba

Thanks for this. I got the same problematic behaviour. Can you add @kamilogorek too in you sample project please?

BTW, which type of new project do you use in your xCode? I created a new iOS SwiftUI from scratch and did not got the same outcome.

brustolin avatar Aug 16 '22 13:08 brustolin

Sure, I will add him. I create iOS project with Storyboard interface.

artur-zaremba avatar Aug 16 '22 13:08 artur-zaremba

Got the repro, found the issue, working on the fix

kamilogorek avatar Aug 16 '22 14:08 kamilogorek

@artur-zaremba should be fixed in 2.5.1, would you mind giving it a try? Thanks for helping us reproduce it.

kamilogorek avatar Aug 16 '22 16:08 kamilogorek

Hi @kamilogorek , I updated to 2.5.1. Create a new xcode project with Xcode 13.3.1. Still the same error 😢

danielrobleM avatar Aug 16 '22 18:08 danielrobleM

@danielrobleM can you provide a concrete repro for this? I verified using @artur-zaremba repro, which had the same bug, and it's fixed now for his case.

kamilogorek avatar Aug 16 '22 19:08 kamilogorek

@danielrobleM your usecase should be fixed in 2.5.2

kamilogorek avatar Aug 17 '22 10:08 kamilogorek

Just in case, faced this issue with sentry-cli upload-dif apparently trying to look up something via .xcodeproj (that was kind of surprising to me - can't see it documented anywhere), even though it was handed .xcarchive with a valid Info.plist. (Btw, when .xcodeproj was not available, sentry-cli had no problem, just complained that result of xcodebuild -list -json -project is not parseable).

The workaround was to force it use Info.plist from .xcarchive itself like below:

sentry-cli upload-dif \
  --log-level debug \
  --auth-token "$SENTRY_API_TOKEN" \
  --org "$SENTRY_ORG" \
  --project "$SENTRY_PROJECT" \
  --include-sources \
  --info-plist "$ARCHIVE_PATH"/*/Applications/*.app/Contents/Info.plist \
  "$ARCHIVE_PATH"

grigorye avatar May 27 '23 02:05 grigorye