SAP / cloud-sdk-ios

Get the binary frameworks of the SAP BTP SDK for iOS through SPM and learn about related open-source Swift packages
Apache License 2.0
19 stars 6 forks source link

Could not be resolve package dependencies #90

Closed leodompr closed 2 months ago

leodompr commented 4 months ago

Whenever I try to add dependencies to my project, I receive this error. How to fix?

image

MarcoEidinger commented 3 months ago

Hi @leodompr, CI/CD tests indicate that using Swift Package Manager to download SAP BTP SDK for iOS 10.0.1 works with proper configuration. Please check the validity of your credentials.

Screenshot 2024-04-11 at 4 13 48 AM

Or it might be a license issue. The download of the SAP BTP SDK for iOS binary frameworks is powered by SAP's Repository-Based Shipment Channel. RBSC grants access to these repositories based on a license check. License information is based on the purchased software and is attached to your S-user account. So you might want to check your current licenses as described here to ensure that your user has a license for the proper product version.

ravitejabb commented 3 months ago

Issue is still happening even with proper licensing. (tried both 10.0.1 and 24.4.0) image

MarcoEidinger commented 3 months ago

Hi @ravitejabb,

can you please provide me the output for the below command from your terminal:

curl -vsnO https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPCommon/24.4.0/SAPCommon-24.4.0-Release.xcframework.zip

Alongside this, please check if the user has been expired or not which you can do by logging on Technical Users' UI Home Page.

Thanks, Marco

ravitejabb commented 3 months ago

It's downloading a zip file around 2.5MB

MarcoEidinger commented 3 months ago

Thank you, @ravitejabb, for providing the information that you could download the SAPCommon.xcframework.zip from the command-line tool. This tells me that your user 'abc-xyz’ (you probably replaced the actual user name for privacy reasons) has the correct permission and that your .netrc file is correct. Otherwise, the download would have failed with HTTP 401

The Swift Package Manager uses the same URL for downloading the binary framework. FYI that you can see all download URLs in https://github.com/SAP/cloud-sdk-ios/blob/main/Package.swift. The Swift Package Manager also evaluates your .netrc file and adds the required Authorization header when attempting to download the binary framework.

So in your case, it's not a permission issue but I don't think it's a checksum issue or others because the CI/CD job tests the download of the binary frameworks by using swift package resolve for this package

Please provide the full logs so that we can determine why you receive "invalid archive returned from" messages in Xcode. I cannot determine the root cause merely on the screenshot snippet you provided.

Cheers, Marco

ravitejabb commented 3 months ago

XCode logs

Showing All Errors Only invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPCommon/24.4.0/SAPCommon-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPCommon'

invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFiori/24.4.0/SAPFiori-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPFiori'

invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFoundation/24.4.0/SAPFoundation-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPFoundation'

invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPOData/24.4.0/SAPOData-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPOData'

invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFioriFlows/24.4.0/SAPFioriFlows-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPFioriFlows'

invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPML/24.4.0/SAPML-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPML'

invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPOfflineOData/24.4.0/SAPOfflineOData-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPOfflineOData'

fatalError

Resolving Package Graph Failed 15/04/24, 10:59 PM 6.1 seconds

MarcoEidinger commented 3 months ago

@ravitejabb which Xcode version are using? And do you get any failures when cloning this repository and run swift package resolve? The downloaded artifacts should be visible then in .buid/artifacts/cloud-sdk-ios-main

ravitejabb commented 3 months ago

XCode 15.3, Yes, when i clone the repo and run swift package resolve it's failing and giving the cached data.

Fetching binary artifact https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPCommon/24.4.0/SAPCommon-24.4.0-Release.xcframework.zip from cache Fetching binary artifact https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFiori/24.4.0/SAPFiori-24.4.0-Release.xcframework.zip from cache Fetching binary artifact https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFioriFlows/24.4.0/SAPFioriFlows-24.4.0-Release.xcframework.zip from cache error: invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPCommon/24.4.0/SAPCommon-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPCommon' error: invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFiori/24.4.0/SAPFiori-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPFiori' Fetching binary artifact https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFoundation/24.4.0/SAPFoundation-24.4.0-Release.xcframework.zip from cache error: invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFioriFlows/24.4.0/SAPFioriFlows-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPFioriFlows' Fetching binary artifact https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPOData/24.4.0/SAPOData-24.4.0-Release.xcframework.zip from cache Fetching binary artifact https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPOfflineOData/24.4.0/SAPOfflineOData-24.4.0-Release.xcframework.zip from cache Fetching binary artifact https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPML/24.4.0/SAPML-24.4.0-Release.xcframework.zip from cache error: invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPFoundation/24.4.0/SAPFoundation-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPFoundation' error: invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPOData/24.4.0/SAPOData-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPOData' error: invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPOfflineOData/24.4.0/SAPOfflineOData-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPOfflineOData' error: invalid archive returned from 'https://rbsc.repositories.cloud.sap/nexus3/repository/maven73554900100900008403/ios/SAPML/24.4.0/SAPML-24.4.0-Release.xcframework.zip' which is required by binary target 'SAPML' error: fatalError

MarcoEidinger commented 3 months ago

@ravitejabb looking at a similar https://github.com/apple/swift-package-manager/issues/6635 it is suggested that this might be either a caching or a keychain issue.

to clear the caches please run

rm -rf $HOME/Library/Caches/org.swift.swiftpm/ rm -rf $HOME/Library/org.swift.swiftpm Try to resolve packages again.

For keychain issue please open Keychain Access and search for github on Passwords. Check and, if required, remove it.

Try to resolve packages again.

ravitejabb commented 3 months ago

Looks like it's cache issue, It worked after running above commands, Thanks.

MarcoEidinger commented 3 months ago

@leodompr please check if the following tips help you as well. If not please come back and provide more information. I'll leave this issue open for another week.

mateuszbo commented 3 months ago

Hi Do you have any suggestion for this log. I'm sure that login/password are correct in .netrc file. I'm using XCode 15.3.

MarcoEidinger commented 3 months ago

Hi @mateuszbo, in your logs I see Couldn't find host rbsc.repositories.cloud.sap in the .netrc file; using defaults

Please check your .netrc file if it contains a such an entry: machine rbsc.repositories.cloud.sap login yourusername password yourpassword

mateuszbo commented 3 months ago

Hi @MarcoEidinger

Ok in my case .netrc was in the wrong location. But still can't download the package in XCode.

_* Trying 3.123.237.30:443...

Zrzut ekranu 2024-04-25 o 09 37 34 _

P.S I was able to resolve this after restart and: rm -rf $HOME/Library/Caches/org.swift.swiftpm/ rm -rf $HOME/Library/org.swift.swiftpm

MarcoEidinger commented 2 months ago

Happy to hear that @mateuszbo was able to resolve the issue.

Didn't hear back from @leodompr. If the tips in this thread don't help then please open a new issue.