expo icon indicating copy to clipboard operation
expo copied to clipboard

Expo Could Not Build iOS Enterprise

Open amowu opened this issue 8 years ago • 24 comments

Environment

Environment:
  OS: macOS High Sierra 10.13.4
  Node: 8.9.4
  Yarn: 1.3.2
  npm: 5.6.0
  Watchman: 4.7.0
  Xcode: Xcode 9.3 Build version 9E145
  Android Studio: Not Found

Packages: (wanted => installed)
  expo: ^26.0.0 => 26.0.0
  react: 16.3.0-alpha.1 => 16.3.0-alpha.1
  react-native: https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz => 0.54.2

Steps to Reproduce

  1. $ EXPO_DEBUG=true exp build:ios -e -c

Expected Behavior

Building Standalone Apps should work.

Actual Behavior

I am a ADP enterprise admin account, but I got a The selected team does not have a program membership that is eligible for this feature. error.

18:11:22 [exp] Making sure project is set up correctly...
18:11:35 [exp] Your project looks good!
18:11:37 [exp] Checking if current build exists...

18:11:39 [exp] No currently active or previous builds for this project.
18:11:40 [exp] Removed existing credentials from expo servers

? How would you like to upload your credentials?
 Expo handles all credentials, you can still provide overrides

We need your Apple ID/password to manage certificates and
provisioning profiles from your Apple Developer account.

Note: Expo does not keep your Apple ID or your Apple password.

? What's your Apple ID? [email protected]
? Password? [hidden]
18:11:55 [exp] Validating Credentials...
18:12:02 [exp] Only 1 team associated with your account, using Team ID: XXXXXXXXXX
? Will you provide your own Distribution Certificate? Let Expo handle the process
? Will you provide your own Push Certificate? Let Expo handle the process
18:12:31 [exp] Error while gathering & validating credentials
18:12:31 [exp] {}
18:12:31 [exp] Reason:Unexpected response, raw:{"responseId":"fd35d027-02f0-4884-ad74-34d97010ecfd","resultCode":4100,"resultString":"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","userString":"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","creationTimestamp":"2018-04-16T10:12:31Z","protocolVersion":"QH65B2","userLocale":"en_US","requestUrl":"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action","httpCode":200}
18:12:31 [exp] Error: Reason:Unexpected response, raw:{"responseId":"fd35d027-02f0-4884-ad74-34d97010ecfd","resultCode":4100,"resultString":"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","userString":"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","creationTimestamp":"2018-04-16T10:12:31Z","protocolVersion":"QH65B2","userLocale":"en_US","requestUrl":"https://developer.apple.com/services-account/QH65B2/account/ios/profile/createProvisioningProfile.action","httpCode":200}
    at IOSBuilder._throwIfFailureWithReasonDump (/[email protected]/src/commands/build/IOSBuilder.js:458:13)
    at IOSBuilder._callee5$ (/[email protected]/src/commands/build/IOSBuilder.js:257:10)
    at tryCatch (/Users/amowu/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/amowu/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/amowu/.config/yarn/global/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/Users/amowu/.config/yarn/global/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Users/amowu/.config/yarn/global/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

amowu avatar Apr 16 '18 10:04 amowu

Can you make sure your account has been renewed, and see if Apple Developer Program Support has any advice for you?

tcdavis avatar Apr 16 '18 23:04 tcdavis

As @tcdavis mentioned, we just check Apple's API to see what kind of team you're using. It sounds like for whatever reason, they don't seem to think that the credentials you provided are eligible to build Enterprise builds. Let us know if you're still having trouble.

terribleben avatar Apr 26 '18 16:04 terribleben

It looks like Apple's API has changed. When I manually join my UDID, exp build:ios worked.

amowu avatar Apr 30 '18 09:04 amowu

hi @amowu, Could you elaborate on how you make it work? I'm having the same issue

snavaneeth78 avatar May 16 '18 10:05 snavaneeth78

Hi, I'm having the same issue but I'm trying to build a regular iOS build, not an enterprise one. It also used to work for me a while back, the only change I've made this time around was the email the account was using. I've already contacted Apple Support on this matter and will update you on what they said.

dariocravero avatar May 20 '18 11:05 dariocravero

False alarm on my case, it seemed to have been an issue on Apple's side because it just worked today :man_shrugging:

dariocravero avatar May 22 '18 09:05 dariocravero

@snavaneeth78 try adding your iOS device UDID to your ADP first, and run exp build:ios again.

amowu avatar May 24 '18 10:05 amowu

I think we recently made some changes which should fix some issues people were having with enterprise builds. Can any of the reporters on this thread try again and let us know if you're still running into the same issue?

terribleben avatar Jul 09 '18 23:07 terribleben

@terribleben

Running exp build:ios -e I still get this error on expo SDK 28.0.0 , exp 57.0.1

[16:18:04] Error while gathering & validating credentials
[16:18:04] Reason:Unexpected response, raw:{"responseId":"2ec4cfc4-710a-4a5a-81f7-60a9ea325b54","resultCode":4100,"resultString":"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","userString":"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","creationTimestamp":"2018-09-05T10:48:04Z","protocolVersion":"QH65B2","userLocale":"en_US","requestUrl":"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action","httpCode":200}
[16:18:04] Set EXPO_DEBUG=true in your env to view the stack trace.

The associated account has admin role in enterprise program

shastri9999 avatar Sep 05 '18 10:09 shastri9999

Exactly the same issue here. Tried with all Team Agent and Admin in the enterprise account.

? Will you provide your own Distribution Certificate? Let Expo handle the process ? Will you provide your own Push Certificate? Let Expo handle the process [12:36:49] Error while gathering & validating credentials [12:36:49] Reason:Unexpected response, raw:{"responseId":"0a074cbb-b247-4234-a53e-7918b7eaf86e","resultCode":4100,"resultString":"The selected team does not have a program membership that is eligible for this feature. If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","userString":"The selected team does not have a program membership that is eligible for this feature. If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support","creationTimestamp":"2018-09-07T19:36:49Z","protocolVersion":"QH65B2","userLocale":"en_US","requestUrl":"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action","httpCode":200} [12:36:49] Set EXPO_DEBUG=true in your env to view the stack trace.

mrlambchop avatar Sep 07 '18 19:09 mrlambchop

Same issue, I have tried it with my admin account and even the root account. Same result.

bocodigital avatar Oct 10 '18 16:10 bocodigital

Still no success. Tried with: EXPO_DEBUG=true expo build:ios --release-channel qa --apple-enterprise-account --revoke-apple-dist-certs --revoke-apple-push-certs --revoke-apple-provisioning-profile

Same error as above...

hwaterke avatar Nov 20 '18 11:11 hwaterke

I faced the same problem and I asked it to Apple. The answer was:

Apple plans extra examination right after the account of Apple Developer Enterprise Program open and it takes 2 weeks more to enable the app to be published. If you in a hurry for testing, you can use Ad hoc version. Specifically, you can't create Production Provisioning Profile during the examining phase. Your account is now under this status.

(This is translation of the answer from Japanese to English by me)

According to this instruction, maybe we have to wait several weeks if you see the error. By the way, in the developer account dashboard I think there is no clue to detect we're in this status.

metheglin avatar Nov 21 '18 06:11 metheglin

@hwaterke @mrlambchop could you check out metheglin's comment and verify this?

jakubste avatar Nov 29 '18 12:11 jakubste

Status Updated:

Our project has spent more than 2 weeks after requesting Enterprise Program and I confirmed we got the same error on it though apple support confirmed our account got enabled. I checked this issue specifically so let me share my confirmation.

First of all, my error was a little different from @amowu case. It looks the same as @mrlambchop case like below.

Error: Reason: Unexpected response, raw: {
  "responseId": "b8a210d6-3d6e-4555-af0b-c13a9eced892",
  "resultCode": 4100,
  "resultString": "The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support",
  "userString": "The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support",
  "creationTimestamp": "2018-11-29T16:07:46Z",
  "protocolVersion": "QH65B2",
  "userLocale": "en_US",
  "requestUrl": "https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action",
  "httpCode": 200
}

It indicates the error happens at submitCertificateRequest phase, not createProvisioningProfile.

I tried the same operation(to create certificate with CSR uploading) at web developer console manually and it got success. Since it communicates with apple server by XHR, I could get the request and response of the success case. I hope this information will be helpful for more deep investigation.

Request URL: https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action?content-type=text/x-url-arguments&accept=application/json&requestId=786590f2-80b0-4588-y06c-d3e63a836833&userLocale=en_US&teamId=xxxxxxxxxx
Request Method: POST
Status Code: 200 OK
Remote Address: 17.253.69.206:443
Referrer Policy: no-referrer-when-downgrade

[Form Data]
csrContent: -----BEGIN CERTIFICATE REQUEST-----
xxxxxxxxxxxx certificate request here xxxxxxxxxxxx
-----END CERTIFICATE REQUEST-----
type: 9RQEK7MSXA
{
  "certRequest": {
    "certRequestId": "T4JNHV9U93",
    "certRequestStatusCode": 4,
    "certificate": {
      "certificateId": "T4JNHV9U93",
      "certificatePlatform": "ios",
      "certificateType": {
        "certificateTypeDisplayId": "9RQEK7MSXA",
        "daysOverlap": 364,
        "distributionMethod": "app",
        "distributionType": "distribution",
        "downloadFileName": "ios_distribution.cer",
        "maxActive": 2,
        "name": "iOS Distribution",
        "ownerType": "team",
        "permissionType": "distribution",
        "platform": "ios"
      },
      "displayName": "**** Corporation",
      "expirationDate": "2021-11-28",
      "expirationDateString": "Nov 28, 2021",
      "hasAskKey": false,
      "name": "iOS Distribution: **** Corporation",
      "serialNumber": "7C7E22474E1A8F90",
      "status": "Issued",
      "statusCode": 0
    },
    "certificateId": "T4JNHV9U93",
    "certificateStatusCode": 0,
    "certificateType": {
      "certificateTypeDisplayId": "9RQEK7MSXA",
      "daysOverlap": 364,
      "distributionMethod": "app",
      "distributionType": "distribution",
      "downloadFileName": "ios_distribution.cer",
      "maxActive": 2,
      "name": "iOS Distribution",
      "ownerType": "team",
      "permissionType": "distribution",
      "platform": "ios"
    },
    "certificateTypeDisplayId": "9RQEK7MSXA",
    "csrPlatform": "ios",
    "dateCreated": "2018-11-29T16:12:33Z",
    "dateRequested": "2018-11-29T16:12:33Z",
    "dateRequestedString": "Nov 29, 2018",
    "expirationDate": "2021-11-28T16:02:33Z",
    "expirationDateString": "Nov 28, 2021",
    "name": "**** Corporation",
    "ownerId": "xxxxxxxxxx",
    "ownerName": "**** Corporation",
    "ownerType": "team",
    "serialNum": "7C7E22474E1A8F90",
    "statusCode": 4,
    "statusString": "Issued",
    "typeString": "iOS Distribution"
  },
  "creationTimestamp": "2018-11-29T16:12:33Z",
  "isAdmin": true,
  "isAgent": false,
  "isMember": false,
  "protocolVersion": "QH65B2",
  "requestId": "786590f2-80b0-4588-y06c-d3e63a836833",
  "requestUrl": "https://developer.apple.com:443/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action?content-type=text/x-url-arguments&accept=application/json&requestId=786590f2-80b0-4588-y06c-d3e63a836833&userLocale=en_US&teamId=xxxxxxxxxx",
  "responseId": "ca3520fe-a821-4c5a-97f2-fdbbd7ac99a4",
  "resultCode": 0,
  "userLocale": "en_US"
}

By the way, I also got success to create provisioning profile on apple developer console. I can share the request/response of that XHR too. Please let me know if anyone want it.

metheglin avatar Nov 29 '18 16:11 metheglin

@jakubste I clarified the cause. Please check this.

■Conclusion https://github.com/expo/expo-cli/blob/5c1ca0be519567cbe3d1ede6f81fcc1160070a85/packages/traveling-fastlane/actions/fetch_cert.rb#L21-L22 These 2 lines are mistaken. They should be like below.

Spaceship::Portal.certificate.in_house.create!(csr: csr)
certs = Spaceship::Portal.certificate.in_house.all()

■Confirmation using our account

Setting up

gem install fastlane
gem list fastlane
# *** LOCAL GEMS ***
# commander-fastlane (4.4.6)
# fastlane (2.108.0)

Reproduce the error along with the code at fetch_cert.rb.

require 'spaceship'
Spaceship::Portal.login('[email protected]', '****')
Spaceship::Portal.client.team_id = 'my-teamid-here-with-enabled-enterprice-program'
csr, pkey = Spaceship.certificate.create_certificate_signing_request()
Spaceship::Portal.certificate.in_house.production.create!(csr: csr)
Spaceship::UnexpectedResponse: {"responseId"=>"aa60fd9a-f12f-4d22-aac2-1a18dbf3ce1f", "resultCode"=>4100, "resultString"=>"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support", "userString"=>"The selected team does not have a program membership that is eligible for this feature.  If you need assistance, please contact Apple Developer Program Support. https://developer.apple.com/support", "creationTimestamp"=>"2018-11-30T10:49:48Z", "protocolVersion"=>"QH65B2", "userLocale"=>"en_US", "requestUrl"=>"https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action", "httpCode"=>200}

Here is the request header information during submitCertificateRequest.

POST https://developer.apple.com/services-account/QH65B2/account/ios/certificate/submitCertificateRequest.action
  User-Agent: Spaceship 2.108.0
  Content-Type: application/x-www-form-urlencoded
  csrf: 136e97045645fe39447d74b64d71e4c9dcb42ba10f7f0277c5f36a3ad46b33a2
  csrf_ts: 1543577024871

  appIdId&csrContent=-----BEGIN+CERTIFICATE+REQUEST-----===generated csr here===-----END+CERTIFICATE+REQUEST-----%0A&teamId=my-teamid-here-with-enabled-enterprice-program&type=R58UK2EWSO"

The value of type is different from XHR requested on developer console with manual operation. For inhouse app, type seems to be 9RQEK7MSXA.

To confirm the error fixed with the unit operation below. (I also confirmed it is created on developer console)

require 'spaceship'
Spaceship::Portal.login('[email protected]', '****')
Spaceship::Portal.client.team_id = 'my-teamid-here-with-enabled-enterprice-program'
csr, pkey = Spaceship.certificate.create_certificate_signing_request()
Spaceship::Portal.certificate.in_house.create!(csr: csr)
certs = Spaceship::Portal.certificate.in_house.all()

[UPDATED] Also this line should be fixed. https://github.com/expo/expo-cli/blob/5c1ca0be51/packages/traveling-fastlane/actions/fetch_new_provisioning_profile.rb#L20

metheglin avatar Nov 30 '18 11:11 metheglin

I'm running into the same issue as metheglin and, I suspect, many others. Has anyone found a workaround for this? This is my first Expo project and I've been really impressed with it, but it's really a showstopper for me to not actually be able to deploy on iOS. I've started going down the "eject" route, but that poses its own set of problems. I'd be curious to hear how others have gotten around this.

revengeofthepencil avatar Dec 06 '18 14:12 revengeofthepencil

@revengeofthepencil Let me share the workaround in my case. First of all, I'm using expo-cli. If you use expo command line, I'm not sure if the following procedure works well. In addition to this, maybe you have to check your error carefully. If you got the apple communication error with the message createProvisioningProfile.action, probably you just wait for a while additional examining phase https://github.com/expo/expo/issues/1663#issuecomment-440553334. If you got your error with the message submitCertificateRequest.action, the following workaround may be good for you.

Check expo-cli install dir

% which expo-cli
/usr/local/bin/expo-cli
% ls -l /usr/local/bin/expo-cli
lrwxr-xr-x  1 metheglin  admin  40 11 20 16:41 /usr/local/bin/expo-cli@ -> ../lib/node_modules/expo-cli/bin/expo.js

In this case, install dir is /usr/local/lib/node_modules/expo-cli.

Hotfix fetch_cert.rb directly on your local

% find /usr/local/lib/node_modules/expo-cli -name 'fetch_cert.rb'
/usr/local/lib/node_modules/expo-cli/node_modules/@expo/traveling-fastlane-darwin/traveling-fastlane-1.6.0-osx/lib/app/fetch_cert.rb

Change the logic inside $isEnterprise == 'true like below. Please make a backup on your responsibility.

# Spaceship::Portal.certificate.in_house.production.create!(csr: csr)
# certs = Spaceship::Portal.certificate.in_house.production.all()
Spaceship::Portal.certificate.in_house.create!(csr: csr)
certs = Spaceship::Portal.certificate.in_house.all()

# is a comment out syntax of ruby.

Hotfix fetch_new_provisioning_profile.rb directly on your local

% find /usr/local/lib/node_modules/expo-cli -name 'fetch_new_provisioning_profile.rb'
/usr/local/lib/node_modules/expo-cli/node_modules/@expo/traveling-fastlane-darwin/traveling-fastlane-1.6.0-osx/lib/app/fetch_new_provisioning_profile.rb

Change the logic inside $isEnterprise == 'true like below. Please make a backup on your responsibility.

# certs = Spaceship::Portal.certificate.in_house.production.all
certs = Spaceship::Portal.certificate.in_house.all

Run again

Try build:ios again.

By the way, we could distribute inhouse app with this workaround without ejecting expo project.

metheglin avatar Dec 07 '18 05:12 metheglin

@metheglin Your workaround worked perfectly for me, and unblocked me - thank you much.

Has anyone created a PR for this? This seems critical (for enterprise users) to get into the next version

mattrabe avatar Dec 11 '18 21:12 mattrabe

I am also having this issue with createProvisioningProfile.action. It does not allow me to build any enterprise account (I've tried two), before or after @metheglin 's workaround. I am able to successfully build when I use an individual account. Any ideas?

timnlupo avatar Jan 10 '19 20:01 timnlupo