I want to build my iOS app on expo CIs servers using my own Gitlab-CI jobs.
The job looks like this (with EXPO_APPLE_ID
and EXPO_APPLE_PASSWORD
environment variables set)
expo build:ios --apple-id "${EXPO_APPLE_ID}" --release-channel staging --non-interactive
My .gitlab-ci.yml
job look like this:
script: - yarn - npx expo start & - EXPO_PID=$(echo $!) - echo $EXPO_PID - expo build:ios --release-channel staging - expo build:ios --apple-id "${EXPO_APPLE_ID}" --release-channel staging --non-interactive - curl -o ios-${CI_BUILD_TAG}-staging.ipa "$(npx expo url:ipa --non-interactive)" - kill -9 $EXPO_PID
It fails with:
[17:38:33] Checking if there is a build in progress... [17:38:37] Accessing credentials for me in project myproject-native [17:38:37] Authenticating to Apple Developer Portal... [17:38:40] Authentication with Apple Developer Portal failed! [17:38:40] Reason: Unknown reason, raw: "<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>Apple</center>\r\n</body>\r\n</html>\r\n\n" [17:38:40] Error: Reason: Unknown reason, raw: "<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>Apple</center>\r\n</body>\r\n</html>\r\n\n" at runAction (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/appleApi/fastlane.ts:28:17) at processTicksAndRejections (internal/process/task_queues.js:97:5) at authenticate (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/appleApi/authenticate.ts:47:40) at Context.ensureAppleCtx (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/credentials/context.ts:81:24) at IOSBuilder.bestEffortAppleCtx (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/commands/build/ios/IOSBuilder.ts:81:14) at IOSBuilder.prepareCredentials (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/commands/build/ios/IOSBuilder.ts:153:5) at IOSBuilder.run (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/commands/build/ios/IOSBuilder.ts:62:7) at IOSBuilder.command (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/commands/build/BaseBuilder.ts:39:7) at Command.<anonymous> (/mnt/mesos/sandbox/builds/me/myapp-native/node_modules/expo-cli/src/exp.ts:79:7) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @me/myapp-native@1.2.102 build:ios:staging: `expo build:ios --apple-id "${EXPO_APPLE_ID}" --release-channel staging --non-interactive` npm ERR! Exit status 1
It work fine if I just run with --simulator
and build a tar.gz
instead of an ipa
.
The error is thrown on this line: https://github.com/expo/expo-cli/blob/expo-cli%403.24.0/packages/expo-cli/src/appleApi/fastlane.ts#L28
Why do I get the 502 Bad Gateway
error on expo build and how to fix it?