apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.87k stars 717 forks source link

Xcode Install CLI fails for versions >=1.8 #3333

Closed pjf-amexgbt closed 4 months ago

pjf-amexgbt commented 7 months ago

Summary

Xcode is unable to download/install CLI from Xcode from version 1.8 on.

This is what happened in previous versions (including 1.7):

Screenshot 2024-02-08 at 17 07 06

This is what happens now (including 1.9):

Screenshot 2024-02-08 at 17 05 37

Version

1.9

Steps to reproduce the behavior

Now:

  1. Add Apollo library to iOS App with version 1.9

    image
  2. Install CLI:

    image
  3. Error received and CLI not created:

    Screenshot 2024-02-08 at 17 05 37
  4. Add Apollo library to iOS App with version 1.7

    image
  5. Install CLI:

    image

    3: CLI Created

    image

Logs

No response

Anything else?

Confirmed with a coworker and it's happening for them as well. It's possible this is being stopped by the corporate VPN, but it's unclear based on the error shown

BobaFetters commented 7 months ago

@pjf-amexgbt Hmm the error seems to think its an issue unpacking the .tar.gz, but it could honestly also be a download issue like you mentioned as well. I can look into some and see if I can reproduce, and also maybe improve the error logging some to be more clear, in the meantime can you take a look in your project directory while running the plugin and see if you see a apollo-ios-cli.tar.gz file show up and maybe be deleted? That would help tell us if the download is actually happening or not.

calvincestari commented 7 months ago

~@pjf-amexgbt you mentioned that the error is "from version 1.8 on". If you target 1.7.1 exactly is the error resolved or still present? If this is a VPN networking issue the problem should occur with 1.7.1 too.~

Not relevant since we only changed the CLI installation to download the binary from 1.8.0 onwards.

BobaFetters commented 7 months ago

The tar: Error opening archive: Failed to open 'apollo-ios-cli.tar.gz' can definitely be thrown if the .tar.gz file is missing which would give further evidence that the download just isnt happening. @pjf-amexgbt Possible you could try to just manuall run the curl command to do the download in terminal and see what kind of errors/issues it gives you maybe related to your VPN?

curl -L https://www.github.com/apollographql/apollo-ios/releases/download/1.8.0/apollo-ios-cli.tar.gz

BobaFetters commented 7 months ago

Closing this since there hasn't been any activity, if this is still an issue feel free to reopen.

github-actions[bot] commented 7 months ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

pjf-amexgbt commented 7 months ago

@BobaFetters Apologies for the slow response, forgot to link accounts so didn't get a notification.

Yeah it does seem to be a download issue. A VPN block was my guess, but I did test with curl -L "https://www.github.com/apollographql/apollo-ios/releases/download/1.8.0/apollo-ios-cli.tar.gz" -s -o "apollo-ios-cli.tar.gz" and it downloads the file without issue.

I did a bit of additional investigation playing with "download-cli.sh" am getting some odd results.

So it seems it may be caused by some combination of running it through Xcode and the wonderful corporate laptop "Security" 🫠

However, wondering if there's a reason to download the file? Especially when it seems to (currently) be included in the repo: https://github.com/apollographql/apollo-ios/tree/main/CLI

pjf-amexgbt commented 7 months ago

Also, I apparently am unable to re-open. Feel free to do so, I should be more responsive now :)

BobaFetters commented 7 months ago

@pjf-amexgbt no problem, hmmm yea I guess maybe its an issue with the curl command when run through xcode then. Something I can definitely look into. As far as the need to download the file, originally the file was packed with the library and then unzipped by the plugin, we wanted to reduce the downloaded library size by removing the built in tar.gz and having the plugin download it instead, although we ran into an issue with the Cocoapods support still needing the built-in tar.gz. This is something we will revisit and see if we can either fix the download issue and remove the issue with Cocoapods to have the included tar.gz or we may just revert back to having the plugin work based on the built-in tar.gz

pjf-amexgbt commented 7 months ago

Thank you for looking into it! It would be nice to have the option of building it from source. It seems that option was removed with the CLI changes (and also the "Build it Yourself" section is now out of date here 🙃 docs/ios/code-generation/codegen-cli/#installation)

BobaFetters commented 7 months ago

Ah thanks for the callout on the documentation needing updated, will take care of that. As far as being able to build it yourself, that isn't possible with the plugin anymore because of the changes that were made to our git structure to modularize our libraries, more info on that here TLDR; the executable is now part of a separate repo/spm package than the main client library that contains the plugin. So technically you could still download that package and build it yourself you would just need to ensure you pull a matching version.

Also it looks like we should be able to fix the Cocoapods issue we had so the plan currently is to move forward with fixing that and then working on fixing the curl command for the plugin to resolve the issue you are seeing.

github-actions[bot] commented 4 months ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.