braintree / braintree_ios

Braintree SDK for iOS
https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
MIT License
560 stars 294 forks source link

Error on pod install after the release of Braintree version 6.8.0 #1120

Closed mlazari closed 1 year ago

mlazari commented 1 year ago

Braintree SDK Version

6.8.0

Environment

Both

Xcode Version

15.0.1

OS Version & Device

No response

Integration type

CocoaPods

Development Processor

Apple Silicon (M-series chips)

Describe the bug

pod install in a React Native project with react-native-braintree-dropin-ui installed throws this error after the release of Braintree 6.8.0:

JSON::ParserError - Failed to parse JSON at file: '/Users/mihai/.cocoapods/repos/trunk/Specs/d/a/5/Braintree/6.8.0/Braintree.podspec.json'.

If I open that json file, it is empty. I tried to clean pods cache an re-run pod install, but it didn't help:

rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "${HOME}/.cocoapods"
rm -rf Pods
pod install

It seems to be related to using CocoaPods CDN - source 'https://cdn.cocoapods.org/' line in ios/Podfile. If I change that to source 'https://github.com/CocoaPods/Specs.git' it takes a lot of time to install first time after clearing the cache, but works without errors.

I am using cocoapods 1.13.0, but tried it with 1.14.0 and it's the same.

To reproduce

  1. Create a React Native project:

    npx react-native init BraintreeRepro
  2. Install react-native-braintree-dropin-ui:

    npm i react-native-braintree-dropin-ui@1.1.7
  3. Add this line to the beginning of the ios/Podfile file in the React Native project:

    source 'https://cdn.cocoapods.org/'
  4. Clear cocoapods related caches:

    rm -rf "${HOME}/Library/Caches/CocoaPods"
    rm -rf "${HOME}/.cocoapods"
    cd ios
    rm -rf Pods
  5. Run pod install in the ios folder:

    pod install
  6. See the error:

    JSON::ParserError - Failed to parse JSON at file: '/Users/mihai/.cocoapods/repos/trunk/Specs/d/a/5/Braintree/6.8.0/Braintree.podspec.json'.

Expected behavior

pod install completes without errors.

Screenshots

No response

jaxdesmarais commented 1 year ago

Hello @mlazari -

The SDK react-native-braintree-dropin-ui was not developed by Braintree. I would recommend reaching out to the developers of that SDK directly for further assistance on this error. That said there are also several issues related to this opened on the Cocoapods repository - I expect this issue ultimately lies with the Cocoapods CDN which our SDK does not own.

mlazari commented 1 year ago

@jaxdesmarais The same thing is happening in a non React Native project that uses this pod directly:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

source 'https://cdn.cocoapods.org/'

target 'BraintreeTest' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for BraintreeTest

  pod 'Braintree', '6.8.0'

end

Even if an older version is requested, like pod 'Braintree', '5.20.1', the error is still triggered.

I opened this because I thought it might be related to the release of Braintree 6.8.0, like an error during its publication, making it be in a bad state or something. But I understand it might be related just to a issue with Cocoapods CDN and not with the publication process of this version.

In any case it doesn't seem to be related to react-native-braintree-dropin-ui, that was just a way to reproduce the error, since the project in which I encountered this error is a React Native one.

jaxdesmarais commented 1 year ago

Hello @mlazari -

Thanks for reaching back out with those details. This does seem specific to the Cocoapods CDN as the following Podfile downloads the dependencies as expected for multiple versions of our SDK. I was just able to test this with multiple versions successfully in a local Cocoapods project:

platform :ios, '15.0'

target 'bt-ios-cocoapods-testing-demo' do
  pod 'Braintree', '6.8.0' // can replace with any version
end
mlazari commented 1 year ago

@jaxdesmarais Got it, thank you!

mlazari commented 1 year ago

I just found the same issue being reported here: https://github.com/CocoaPods/CocoaPods/issues/12115 for a different dependency, so indeed doesn't seem related to Braintree. Thanks for looking into it.