xcodebuild: error: Could not connect to the server

I'm trying to use automatic provisoning in our build pipeline using the following command:

xcodebuild -project myproj.xcodeproj -scheme myscheme -configuration release -scmProvider system -allowProvisioningUpdates -verbose clean archive -authenticationKeyPath mykeyPath authenticationKeyID myKeyID -authenticationKeyIssuerID myIssuerID

The clean succeeds, but the archive fails with the following error message :

▸ note: Build preparation complete
▸ note: Building targets in dependency order
▸ error: Could not connect to the server. (in target 'myscheme' from project 'myproj')
▸ error: No profiles for 'appid' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'appid'. (in target 'myscheme' from project 'myproj')
▸ ** ARCHIVE FAILED **

On some runs of the pipeline, instead of "could not connect to server" I get the following issue:

▸ error: The request timed out. (in target 'myScheme' from project 'myproj')

The pipeline runs on a dedicated build server which can only connect to the internet using a proxy. The proxy is configured in the system settings and I've already tried the workaround from this thread: https://developer.apple.com/forums/thread/666368

The problem seems to be with the proxy configuration, as it works on my local machine, that doesn't require a proxy. However other services that require the proxy seem to work. When running tests xcodebuild is even able to resolve dependencies from GitHub.

However other services that require the proxy seem to work.

Right. Xcode has many different subsystems and some subsystems don’t use the system networking stack. For example, the thread you referenced was discussing App Store uploads and notarisation, both of which use Java and hence need Java proxy configuration [1].

Based on the context it looks like you’re dealing with the subsystem that uses the App Store Connect API to handle automatic signing. Unfortunately I don’t have any great insight into that aspect of Xcode. If no one else chimes in, my advice is that you open a DTS tech support incident and talk to DTS’s tools specialist.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Note that, on the notarisation front, Xcode is still using the old infrastructure, the same infrastructure used by altool. The new infrastructure, as used by notarytool, does not involve Java.

xcodebuild: error: Could not connect to the server
 
 
Q