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

CocoaPods CDN Returns 403 Error While Fetching EmbraceIO Pod Source #167

Closed
lasha-dave opened this issue Jan 27, 2025 · 2 comments
Closed

Comments

@lasha-dave
Copy link

Issue

When attempting to install the EmbraceIO (v5.25.2) using Cocoapods, the process fails due to a 403 error returned by the CDN when accessing the source file.

However, the pod successfully downloads when fetching from the https://github.com/CocoaPods/Specs.git repository.

Installing EmbraceIO 5.25.2 (source changed to `trunk` from `https://github.com/CocoaPods/Specs.git`)

[!] Error installing EmbraceIO
[!] /usr/bin/curl -f -L -o /var/folders/dw/w9dj5vj52n19qkxqwf1kkw0h0000gn/T/d20250127-42871-m90cd7/file.zip https://embrace-downloads-prod.s3.amazonaws.com/embrace_5.25.2.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.16.2 cocoapods-downloader/2.1'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 403

Details

  1. The error occurs when Cocoapods tries to fetch the source file from the CDN:
    https://cdn.embrace.io/ios-sdk/EmbraceIO-5.25.1.zip
  2. A 403 Forbidden error is returned, indicating the server denies access to the requested resource.
  3. This issue is isolated to the CDN source and does not impact the fetching from the Specs repository.

Potential Causes:

  1. Authentication restrictions on the CDN.
  2. CORS or IP restrictions implemented by the CDN provider.
    1. Rate-limiting by the CDN.
  3. User-agent blocking certain requests (e.g., Cocoapods user-agent).
  4. Misconfiguration of public permissions for the source file.

Environment

OS: Apple M2 Pro
Xcode Version: 16.0
Cocoapods Version: 1.16.2
Ruby Version: 3.1.4

@ArielDemarco
Copy link
Collaborator

Hey @lasha-dave ! Thanks for submitting the issue. Gonna give a bit of context:

Context:

This issue occurs because, for some reason, the CocoaPods CDN didn't update correctly (yet), even though we updated all podspecs with the new download URLs a while ago (as you can see, for example, for the official 5.25.2 podspec). This means that some users are still retrieving an outdated version of the podspec, leading to requests being made to the old Amazon S3 URL (the correct URL is https://downloads.embrace.io/embrace_${VERSION}.zip)

Unfortunately, this is out of our control since it is related to how CocoaPods manages caching, both locally and on its CDN.

Solutions:

Switch to the Git-based CocoaPods Specs repo

As you pointed out, one of the easiest solutions is to bypass the CDN entirely by explicitly specifying the Git-based CocoaPods specs repo in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'

And then run

pod repo update ; pod install 
# Other would be
# pod install --repo-update but I prefer the aforementioned one to see the problems the update could have)

Clear the CocoaPods local cache

Alternatively, you can try clearing the local CocoaPods cache to force an update (but, considering the CDN is also caching, there's a possibility it won't help at all):
The safer/less aggressive approach:

pod cache clean --all

or the more aggressive approach (be cautious as this removes all repos, including private ones):

rm -rf ~/.cocoapods/repos
pod setup  # or pod repo add ...

Upgrade to version 6.x or later

Another option is to update to version 6.x or later (current latest version: 6.7.1).

The reason this works is that the 6.x versions were introduced with the new URL from the start; meaning there is no possibility of outdated CDN caching issues affecting them. We have a migration guide in the docs in case you want to try this out.


TL;DR: Since this is a caching issue on CocoaPods side, there’s not much we can do to force an immediate fix, but the above solutions should help resolve it.

@lasha-dave
Copy link
Author

lasha-dave commented Jan 28, 2025

@ArielDemarco Thank you for providing such a thorough and detailed response!

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

No branches or pull requests

2 participants