8

I'm trying to config automatically build iOS apps using Expo through Gitlab-CI. This are the commands that I am using:

expo login -u expo_user -p expo_pass
expo build:ios --non-interactive --apple-id [email protected] --clear-dist-cert --clear-provisioning-profile --dist-p12-path "path_to_file.p12" --provisioning-profile-path "path_to_file.mobileprovision"

I am already passing the respective values of this env vars:

EXPO_APPLE_PASSWORD
EXPO_IOS_DIST_P12_PASSWORD

During the 2nd command execution it launch this logs:

[14:24:23] Trying to authenticate with Apple Developer Portal...
[14:24:25] Authentication with Apple Developer Portal failed!
[14:24:25] 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 (/[email protected]/src/appleApi/fastlane.ts:28:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at Object.authenticate (/[email protected]/src/appleApi/authenticate.ts:46:40)
    at IOSBuilder.getAppleCtx (/[email protected]/src/commands/build/ios/IOSBuilder.js:47:23)
    at IOSBuilder.produceMissingCredentials (/[email protected]/src/commands/build/ios/IOSBuilder.js:123:22)
    at IOSBuilder.prepareCredentials (/[email protected]/src/commands/build/ios/IOSBuilder.js:65:7)
    at IOSBuilder.run (/[email protected]/src/commands/build/ios/IOSBuilder.js:19:7)
    at IOSBuilder.command (/[email protected]/src/commands/build/BaseBuilder.js:55:7)
    at Command.<anonymous> (/[email protected]/src/exp.ts:81:7)

The Apple Developer account that I am using have configured the Two Factor Authentication (2FA).

Is this the reason why the expo build:ios command is failing the auth against Apple Portal? What am I missing in this commands?

PS: These commands on my laptop works fine!

2
  • Have you found a solution to this?
    – Omar Diaa
    Aug 28, 2020 at 7:41
  • I have the same issue and none of the suggested solutions worked for me so far. I am also thinking if this might have to do with the 2FA.
    – stefanS
    Jan 12, 2021 at 18:35

4 Answers 4

2

A similar issue was happening to me in interactive mode on my dev machine.

One thing that happened to work for me was logging into App Store Connect in an incognito window to trigger the 2FA. Not sure if it's a coincidence, but it worked!

For reference, I was getting a similar error on the latest [email protected]

✖ Logging in...
Authentication with Apple Developer Portal failed!
    Error: Apple Service Error -1018. Could Not Complete Request. Your request could not be completed because of an error. Please try again later. Apple servers may be down right
    now, please try again in about 10-20 minutes
0

In addition to the other answers, also ensure that a VPN or site-blocking software is not activated, which was the cause of my issue.

-1

Not a very satisfying answer, but it worked for me: Delete your node_modules and then reinstall all your dependencies.

We had no problem last week, but today we kept hitting this error.

This possible fix has zero risk as long as you have a yarn.lock or NPM's equivalent so that you can be sure the versions you download match the originals.

-4

You Need To Use expo build:ios --clear-credentials it worked fine for me.

As Specified bellow in link.

-c, --clear-credentials Clear all credentials stored on Expo servers.

https://forums.expo.io/t/solved-ios-standalone-build-failed/10007/3?u=alihussnain

1
  • Be careful expo build:ios -c will -c, --clear-credentials Clear all credentials stored on Expo servers. Aug 25, 2020 at 18:08

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.