fastlane / fastlane

🚀 The easiest way to automate building and releasing your iOS and Android apps
https://fastlane.tools
MIT License
39.41k stars 5.67k forks source link

Sigh unable to create/update profiles #349

Closed FloresRobles closed 8 years ago

FloresRobles commented 9 years ago

I'm being unable to create or update profiles for new and existing apps, the only thing sigh is allowing me to do is download existing profiles.

output:

[11:50:14]: ------------------
[11:50:14]: --- Step: sigh ---
[11:50:14]: ------------------
[11:50:14]: Starting login
Logging spaceship web requests to '/tmp/spaceship.log'
[11:50:15]: Successfully logged in
[11:50:16]: Found 1 matching profile(s)
[11:50:16]: Updating the profile to include all devices
[11:50:18]: -----------------------------------
[11:50:18]: --- Step: clean_build_artifacts ---
[11:50:18]: -----------------------------------
[11:50:18]: Cleaned up build artifacts 🐙
[11:50:18]: Variable Dump:
[11:50:18]: {:DEFAULT_PLATFORM=>:ios, :ENVIRONMENT=>"some_env", :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios sigh"}
[11:50:18]: 757: unexpected token at 'HTTP 400 Bad Request'
[11:50:18]: fastlane finished with errors
/Library/Ruby/Gems/2.0.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse': 757: unexpected token at 'HTTP 400 Bad Request' (Faraday::Error::ParsingError)
    from /Library/Ruby/Gems/2.0.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response/parse_json.rb:11:in `block in <class:ParseJson>'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:48:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:48:in `parse'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:39:in `process_response'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:32:in `block in call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.8.9/lib/faraday/response.rb:63:in `on_complete'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:30:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.8.9/lib/faraday/connection.rb:253:in `run_request'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.8.9/lib/faraday/connection.rb:118:in `post'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.8/lib/spaceship/client.rb:468:in `send_request'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.8/lib/spaceship/client.rb:443:in `request'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.8/lib/spaceship/client.rb:398:in `repair_provisioning_profile!'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.8/lib/spaceship/provisioning_profile.rb:320:in `update!'
    from /Library/Ruby/Gems/2.0.0/gems/sigh-0.6.0/lib/sigh/spaceship/runner.rb:29:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/sigh-0.6.0/lib/sigh/manager.rb:8:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/actions/sigh.rb:20:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/fast_file.rb:112:in `block (2 levels) in method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/actions/actions_helper.rb:51:in `execute_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/fast_file.rb:94:in `block in method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/fast_file.rb:93:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/fast_file.rb:93:in `method_missing'
    from (eval):32:in `block (3 levels) in parse'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/runner.rb:35:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/runner.rb:35:in `block in execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/runner.rb:25:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/runner.rb:25:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/lib/fastlane/lane_manager.rb:33:in `cruise_lane'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/bin/fastlane:39:in `block (2 levels) in run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:178:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:178:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:153:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/runner.rb:428:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/runner.rb:68:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/delegates.rb:15:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/bin/fastlane:118:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.3.2/bin/fastlane:124:in `<top (required)>'
    from /usr/bin/fastlane:23:in `load'
    from /usr/bin/fastlane:23:in `<main>'
KrauseFx commented 9 years ago

Could you share your log file from /tmp/spaceship.log? You can send it via email on my profile, since some sensitive data is in it.

FloresRobles commented 9 years ago

I'm afraid I can't (since is the account of my employer), BUT this is the last line:

[12:23:30]: POST: account/ios/profile/regenProvisioningProfile.action {teamId: TEAMID}, {provisioningProfileId: PROPROID}, {provisioningProfileName: com.company.app AdHoc}, {appIdId: SOMEAPPID}, {distributionType: adhoc}, {certificateIds: ["CertificateID"]}, {deviceIds: ["Many", "IDS"]}

I believe the reason could be the parameter name "appIdId" in the request

yannisroy commented 9 years ago

Hi,

I experienced the exact same issue when executing sigh to create a Provisioning Profile. I updated fastlane right before this morning, and had the error twice:

/usr/local/Cellar/ruby/2.2.0/lib/ruby/2.2.0/json/common.rb:155:in `parse': 757: unexpected token at 'HTTP 400 Bad Request' (Faraday::ParsingError)

My /tmp/spaceship.log file last line:

POST: account/ios/profile/createProvisioningProfile.action {teamId: $$$$}, {provisioningProfileName: $$$$}, {appIdId: $$$$}, {distributionType: store}, {certificateIds: ["$$$$"]}, {deviceIds: []}

I decided to go for manual creation on the devPortal at the end.

KrauseFx commented 9 years ago

I just tried it again locally and it's working fine for me. I'd need more information to debug this issue.

sfransen commented 9 years ago

It seems to work on small account but large it doesn't work

Sent from my iPhone5

On Jun 13, 2015, at 5:01 AM, Felix Krause notifications@github.com wrote:

I just tried it again locally and it's working fine for me. I'd need more information to debug this issue.

— Reply to this email directly or view it on GitHub.

KrauseFx commented 9 years ago

I can finally reproduce this issue - trying to fix it now :+1:

KrauseFx commented 9 years ago

I just pushed a new version of spaceship, please update using sudo gem update spaceship :rocket: Please let me know if that fixes your problem :+1:

FloresRobles commented 9 years ago

still having the same bug, here is the new log

[13:54:31]: POST: account/ios/profile/regenProvisioningProfile.action {teamId: "$ID$"}, {provisioningProfileId: "$ID$"}, {provisioningProfileName: com.company.product AdHoc}, {appIdId: "$ID$"}, {distributionType: adhoc}, {certificateIds: $ID$}, {deviceIds: ["$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$","$ID$"]}

I just tested two different apps within the same account

terminal output:

[14:01:57]: {:DEFAULT_PLATFORM=>:ios, :ENVIRONMENT=>"some_env", :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios sigh", :PRODUCE_APPLE_ID=>"$ID$"}
[14:01:57]: 757: unexpected token at 'HTTP 400 Bad Request'
[14:01:59]: fastlane finished with errors
/Library/Ruby/Gems/2.0.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse': 757: unexpected token at 'HTTP 400 Bad Request' (Faraday::ParsingError)
    from /Library/Ruby/Gems/2.0.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response/parse_json.rb:11:in `block in <class:ParseJson>'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:48:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:48:in `parse'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:39:in `process_response'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:32:in `block in call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
    from /Library/Ruby/Gems/2.0.0/gems/faraday_middleware-0.9.1/lib/faraday_middleware/response_middleware.rb:30:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
    from /Library/Ruby/Gems/2.0.0/gems/faraday-0.9.1/lib/faraday/connection.rb:177:in `post'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.10/lib/spaceship/client.rb:468:in `send_request'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.10/lib/spaceship/client.rb:443:in `request'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.10/lib/spaceship/client.rb:398:in `repair_provisioning_profile!'
    from /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.10/lib/spaceship/provisioning_profile.rb:320:in `update!'
    from /Library/Ruby/Gems/2.0.0/gems/sigh-0.6.0/lib/sigh/spaceship/runner.rb:29:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/sigh-0.6.0/lib/sigh/manager.rb:8:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/actions/sigh.rb:20:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/fast_file.rb:112:in `block (2 levels) in method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/actions/actions_helper.rb:51:in `execute_action'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/fast_file.rb:94:in `block in method_missing'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/fast_file.rb:93:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/fast_file.rb:93:in `method_missing'
    from (eval):49:in `block (3 levels) in parse'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/runner.rb:39:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/runner.rb:39:in `block in execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/runner.rb:29:in `chdir'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/runner.rb:29:in `execute'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/lib/fastlane/lane_manager.rb:33:in `cruise_lane'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/bin/fastlane:39:in `block (2 levels) in run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:178:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:178:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:153:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/runner.rb:428:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/runner.rb:68:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.3.4/lib/commander/delegates.rb:15:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/bin/fastlane:128:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/fastlane-1.4.0/bin/fastlane:134:in `<top (required)>'
    from /usr/bin/fastlane:23:in `load'
    from /usr/bin/fastlane:23:in `<main>'
KrauseFx commented 9 years ago

Sorry, we're working on this issue, sorry for the troubles.

FloresRobles commented 9 years ago

thanks @KrauseFx, using fastlane 1.2.3 without problems for now

robwithhair commented 9 years ago

@KrauseFx still seeing this issue BTW. Done Gem update/cleanup today.

RandyAdams commented 9 years ago

I'm having this issue also, any idea when a fix or a workaround might be available?
Thanks, randy@ilook.tv

vipulvpatil commented 9 years ago

@KrauseFx I am seeing this in spaceship. Same issue. Downloaded the latest gem today.

vipulvpatil commented 9 years ago

Now I am getting a Bad Request in app.create!

vipulvpatil commented 9 years ago

Ok. After getting this error multiple times consistently, I was able to get things to work. Note: I am using only Spaceship.

This is my Ruby file. This code works consistently with no errors. If I change things a bit around, it stops working. Like If I move the line where I find the certificate, the app creation fails with a bad request. No idea, will dig around more later, if needed.

require('Spaceship')

app_name = "EnterpriseApp"
app_bundle_id = "com.company.enterprise.appname"
profile_name = "profilename"
spaceship = Spaceship.login("myAppleId", "MyPassword")
spaceship.team_id = "MyTeamId"
certificate = Spaceship.certificate.find "MyEnterpriseCertificateId"

app = Spaceship.app.create!(bundle_id: app_bundle_id, name: app_name)

profile = spaceship.create_provisioning_profile!(profile_name,
                                                 "inhouse",
                                                 app.app_id,
                                                 certificate.id,
                                                 [])
KrauseFx commented 9 years ago

I just tried this on different accounts on over >100 profiles and can't reproduce this issue. Definitely not easy, I'll keep trying.

robwithhair commented 9 years ago

I will keep details and logs when I next see this bug.

tabuchid commented 9 years ago

I'm seeing the same issue doing sigh repair we have both a enterprise and a app store teams setup. On our enterprise account have 21 certs.

vipulvpatil commented 9 years ago

The script I posted above works for me. But it breaks, if I remove the line where I grab the certificate and instead do it inline with the provisioning profile creation. Might be a way to simulate the error.

KrauseFx commented 9 years ago

Maybe somehow sigh fetches the wrong certificate.

This code is used to detect which certificate to use:

      if profile_type == Spaceship.provisioning_profile.Development
        certificates = Spaceship.certificate.development.all
      elsif profile_type == Spaceship.provisioning_profile.InHouse
        certificates = Spaceship.certificate.in_house.all
      else
        certificates = Spaceship.certificate.production.all # Ad hoc or App Store
      end

      # Filter them
      certificates = certificates.find_all do |c|
        if Sigh.config[:cert_id]
          next unless (c.id == Sigh.config[:cert_id].strip)
        end

        if Sigh.config[:cert_owner_name]
          next unless (c.owner_name.strip == Sigh.config[:cert_owner_name].strip)
        end

        true
      end

You could try forcing a specific ID or owner name to see if that's the issue. Every extra information is helpful :+1:

gspiers commented 9 years ago

We've been having this problem too on one development machine. Consistently we see the one machine fail where the other one succeeds. It's very strange, I'm pretty certain sigh isn't picking the wrong certificate. I've replace the values in the logs to maintain privacy but here is the results from both machines:

Failed
757: unexpected token at 'HTTP 400 Bad Request'
[10:15:13]: POST: account/ios/profile/createProvisioningProfile.action {teamId: AAA}, {provisioningProfileName: co.myverylongbundleid.bbbbbbbbbbbbbbbbbbbbb Development}, {appIdId: CCC}, {distributionType: limited}, {certificateIds: ["DDD"]}, {deviceIds: ["EEE", "FFF"]}

Success
[14:20:25]: POST: account/ios/profile/createProvisioningProfile.action {teamId: AAA}, {provisioningProfileName: co.myverylongbundleid.bbbbbbbbbbbbbbbbbbbbb Development}, {appIdId: CCC}, {distributionType: limited}, {certificateIds: ["DDD"]}, {deviceIds: ["EEE", "FFF"]}

As you can see both certificateIds are identical (not the real values of course).

The only thing I can think of is that the profile name is very long (that's the real length for our apps). The web interface in the dev portal doesn't allow the provisioning profile name to be that long and actually restricts it. But of course that still doesn't explain why it's working on one machine but not the other.

I'll keep investigating too. Thanks for the great tools!

chrismear commented 9 years ago

I'm the person on @gspiers' team who was getting the HTTP 400 error. We tried again a few hours later and my machine now creates the provisioning profile successfully. We didn't change anything on our side as far as we know, so this does look like it could be just an intermittent problem with the Apple dev portal.

xareelee commented 9 years ago

I've encountered this problem too for a couple of weeks. It failed only when I use both force and adhoc option.

This will fail:

sigh --username xxx@yyy.com --force --adhoc

Those will succeed:

sigh --username xxx@yyy.com --adhoc
sigh --username xxx@yyy.com --force
martynovskij commented 9 years ago

I was faced with the same problem.

sigh -a $PRODUCE_APP_IDENTIFIER -o "PATH_TO_DIR" -f "FILENAME.mobileprovision" ... 757: unexpected token at 'HTTP 400 Bad Request'

Failed by Jenkins, but passed if run it locally.

alextud commented 9 years ago

I did have same problems when creating a new certificate for enterprise account.

It's working after modifying "provisioning_profile.rb" file the following code:

    profile = client.create_provisioning_profile!(name,
                                          self.type,
                                          app.app_id,
                                          [certificate.id],
                                          devices.map {|d| d.id} )

to

    profile = client.create_provisioning_profile!(name,
                                          self.type,
                                          app.app_id,
                                          certificate.id,
                                          devices.map {|d| d.id} )
siuying commented 9 years ago

I had same issue. It might cause by i having two signing identities with expired profile?

[15:51:45]: Starting login
[15:51:46]: Successfully logged in
[15:51:46]: Fetching profiles...
[15:51:52]: No existing profiles, creating a new one for you
[15:51:53]: Found more than one code signing identity. Choosing the first one. Check out `sigh --help` to see all available options.
[15:51:53]: Available Code Signing Identities for current filters:
[15:51:53]:     - Name: <NAME1> - ID: <ID1> - Expires: 13/01/2016
[15:51:53]:     - Name: <NAME2> - ID: <ID2> - Expires: 09/04/2016
[15:51:56]: Creating new provisioning profile for APP1 with name 'APP1 AppStore'
[15:51:58]: Variable Dump:
[15:51:58]: {:ENVIRONMENT=>nil, :PLATFORM_NAME=>nil, :LANE_NAME=>"beta"}
[15:51:58]: 757: unexpected token at 'HTTP 400 Bad Request'
[15:51:59]: fastlane finished with errors
milch commented 9 years ago

I can confirm that @alextud's solution works, changing the type from an array to a single value produces the correct result.

RandyAdams commented 9 years ago

I can confirm it works for me as well.

Regards,

Randy

On Jul 7, 2015, at 09:38, Manu Wallner notifications@github.com wrote:

I can confirm that @alextud's solution works, changing the type from an array to a single value produces the correct result.

— Reply to this email directly or view it on GitHub.

JoeRobles commented 9 years ago

Last gem update (sudo gem update fastlane; sudo gem update spaceship; sudo gem update sigh) contains:

sudo nano +219 /Library/Ruby/Gems/2.0.0/gems/spaceship-0.0.14/lib/spaceship/provisioning_profile.rb

profile = client.create_provisioning_profile!(name,
                                      self.type,
                                      app.app_id,
                                      certificate_parameter,
                                      devices.map {|d| d.id} )

but should be replaced by @alextud solution,

profile = client.create_provisioning_profile!(name,
                                      self.type,
                                      app.app_id,
                                      certificate.id,
                                      devices.map {|d| d.id} )

replacint certificate_parameter by certificate.id is working for me.

KrauseFx commented 9 years ago

Sorry everyone for the long time it took to fix this issue. I couldn't reproduce the issue and still wanted a good fix for it. I just pushed an updated version of spaceship, please update using

sudo gem update spaceship

and let me know if that fixes this issue. If so, I'll publish a new version of sigh as well. Thanks everyone for helping me getting this resolved :+1:

xareelee commented 9 years ago

Thanks @KrauseFx. I've updated both spaceship and sigh to latest version, and now sigh works well. No more HTTP 400 Bad Request raises again.

alextud commented 9 years ago

Thanks @KrauseFx, is working for me.

milch commented 9 years ago

Not working for me anymore, even though the workaround was working fine before:

$ gem list --local | grep 'spaceship\|sigh'
sigh (0.10.1)
spaceship (0.0.15)
$ fastlane certs
... lots of other stuff ...
[21:49:41]: ------------------
[21:49:41]: --- Step: sigh ---
[21:49:41]: ------------------
[21:49:41]: Starting login
[21:49:44]: Successfully logged in
[21:49:44]: Fetching profiles...
[21:49:47]: No existing profiles, creating a new one for you
[21:49:49]: Creating new provisioning profile for '...' with name '... AdHoc'
[21:49:53]: -----------------------------
[21:49:53]: --- Step: delete_keychain ---
[21:49:53]: -----------------------------
[21:49:53]: Variable Dump:
[21:49:53]: {:DEFAULT_PLATFORM=>:ios, :ENVIRONMENT=>nil, :PLATFORM_NAME=>:ios, :LANE_NAME=>ios certs, :PRODUCE_APPLE_ID=>, :CERT_FILE_PATH=>/tmp/cert/..., :CERT_CERTIFICATE_ID=>....}
[21:49:53]: 757: unexpected token at 'HTTP 400 Bad Request' 
FloresRobles commented 9 years ago

same as milch, also when trying to create a new profile for adhoc

FloresRobles commented 9 years ago

also tried another machine, and another ruby version... no luck

daveverwer commented 9 years ago

I wasn't getting this error when other members of the team were, but now I am :smile:. Fastlane and dependencies are all up to date, log file and gem/lock files attached in case they help.

https://gist.github.com/daveverwer/40ebcb8b0c592e40e19c

Dave

romainbiard commented 9 years ago

Also have the Issue. For renew/repair Appstore profiles no problems For AdHoc/Dev Profiles : HTTP 400 Bad Request

Tested on 2 different accounts

capture d ecran 2015-07-23 a 18 59 38 capture d ecran 2015-07-23 a 19 01 26
KrauseFx commented 9 years ago

@romainbiard If you're only now, I need your help: Please go to the Apple Developer Portal and try the following:

Unfortunately I can't reproduce this issue on my account, so I'd really appreciate your help :+1: I want to get this issue resolved ASAP, but it's very hard to track down as it just sometimes works and sometimes breaks with no easy way to reproduce it.

If anyone else from this thread still experiences this issue, I'd appreciate if you could provide this request information for me :+1:

daveverwer commented 9 years ago

I'm around at the moment and just tried doing this, unfortunately com.airsign.Test is already registered. Would you like to do some Skype debugging on it now? I'm available if you're still around.

romainbiard commented 9 years ago
{
    "creationTimestamp": "2015-07-23T17:17:11Z",
    "resultCode": 0,
    "userLocale": "en_US",
    "protocolVersion": "QH65B2",
    "requestId": "2f1c42e4-0451-42a8-a062-a63b5db4d337",
    "requestUrl": "https://developer.apple.com:443//services-account/QH65B2/account/ios/profile/createProvisioningProfile.action?content-type=text/x-url-arguments&accept=application/json&requestId=2f1c42e4-0451-42a8-a062-a63b5db4d337&userLocale=en_US&teamId=GBC4776WTG",
    "responseId": "06f39905-b62c-4770-b9e7-88fc9605061d",
    "isAdmin": true,
    "isMember": false,
    "isAgent": true,
    "pageNumber": null,
    "pageSize": null,
    "totalRecords": null,
    "httpResponseHeaders": null,
    "provisioningProfile": {
        "provisioningProfileId": "3C377UYLDV",
        "name": "com.airsign.Test Development",
        "status": "Active",
        "type": "iOS Development",
        "distributionMethod": "limited",
        "proProPlatform": "ios",
        "proProSubPlatform": null,
        "version": "2",
        "dateExpire": "2016-07-22",
        "managingApp": null,
        "appId": {
            "appIdId": "YC8RR5A7UR",
            "name": "Xcode iOS App ID com airsign Test",
            "appIdPlatform": "ios",
            "prefix": "GBC4776WTG",
            "identifier": "com.airsign.Test",
            "isWildCard": false,
            "isDuplicate": false,
            "features": {
                "push": false,
                "inAppPurchase": true,
                "gameCenter": true,
                "passbook": false,
                "dataProtection": "",
                "homeKit": false,
                "cloudKitVersion": 1,
                "iCloud": false,
                "LPLF93JG7M": false,
                "IAD53UNK2F": false,
                "V66P55NK2I": false,
                "SKC3T5S89Y": false,
                "APG3427HIY": true,
                "HK421J6T7P": false,
                "WC421J6T7P": false
            },
            "enabledFeatures": ["APG3427HIY", "gameCenter", "inAppPurchase"],
            "isDevPushEnabled": false,
            "isProdPushEnabled": false,
            "associatedApplicationGroupsCount": null,
            "associatedCloudContainersCount": null,
            "associatedIdentifiersCount": null
        },
        "appIdId": "YC8RR5A7UR",
        "deviceIds": ["8P3AZ4CUFJ", "7LYZ74A5S8", "W9YR34FSES", "J7UWNU5N2S"],
        "certificateIds": ["925RWGRMLJ"],
        "encodedProfile": "MIIe [Truncated] fauBHHK+WBJgWrAcCEbKetbst3BGSVK9nCkhImgvcwG87gPtIe+mh9p2NWbfQV3M1JbJ6KLbEe0oCoMBu8hrbmpHoVvTMhp/Lv20KVhrscG9IwGim1QAPmYQ+ADkJiXs3M/aVvsC3FB7CC/3E4qudUEYUeenwv4+AoZN5EXdOqaoxLuZILUjMqUZkbXD7C24BPLkbuncJVFrHJa4GZ4DnU2A26qFfoSGdHWsvZbkQ2m/pON56og1PofbRidvRjgHRcK2z9WhJSp0JWBRftgSOxaL9UnRIf/cRXKqQJgzTe3dohSi9MpHKb50iUkR9te13w==",
        "filename": "comairsignTest_Development.mobileprovision",
        "UUID": "853a4280-7fb6-4b22-a907-a88b424daf82"
    }
}
KrauseFx commented 9 years ago

@romainbiard Thanks! And what was the response? Did it work successfully and do you have a valid profile now?

romainbiard commented 9 years ago

Yes of course since the JSON that I’ve posted is from Web Developer tools from Safari, not from your tools. Through SIGH I didn’t manage to make it work (as you saw in the logs).

What is really weird is that I don’t have the issue from Home (fiber access) but only from Work (ADSL access trough a basic gateway).

This could explain why you didn’t manage to reproduce this bug once it should not come from an obvious mistake but rather things like « special character at the beginning of the request », encoding or other stuff like that.

I will definitely help you to find it but as I’m not really familiar with Ruby, I miss some tools to setup a working dev environment. If you have some clues about what you are using, please tell me. If you have a way to enable network traces, it could also help.

Thank you for your time.

Regards, Romain

Le 23 juil. 2015 à 20:20, Felix Krause notifications@github.com a écrit :

@romainbiard https://github.com/romainbiard Thanks! And what was the response? Did it work successfully and do you have a valid profile now?

— Reply to this email directly or view it on GitHub https://github.com/KrauseFx/fastlane/issues/349#issuecomment-124193693.

KrauseFx commented 9 years ago

I just analysed this problem together with @daveverwer and it seems like it really is just a server error. The same error occurs when creating the profile via the website. All you have to do is to try again (maybe multiple times) until it works.

I'd suggest I implement a simple system to retry creating the profile up to 5 times before failing.

KrauseFx commented 9 years ago

I just pushed a new version of spaceship, could you please update using sudo gem update spaceship and let me know if that works for you? :+1:

romainbiard commented 9 years ago

Thank you Felix,

I’ll try tomorrow morning.

Regards, Romain

Le 24 juil. 2015 à 22:18, Felix Krause notifications@github.com a écrit :

I just pushed a new version of spaceship, could you please update using sudo gem update spaceship and let me know if that works for you?

— Reply to this email directly or view it on GitHub https://github.com/KrauseFx/fastlane/issues/349#issuecomment-124708193.

daveverwer commented 9 years ago

I just tried this version and sure enough it retries but it does not get a successful request and eventually fails with the same error still :(

romainbiard commented 9 years ago

It seems to work now thank you !

chrisperelstein commented 9 years ago

I'm still having this same issue. @KrauseFx I'll email you my spaceship.log. I get them same result when generating profiles that don't already exist. Also, sigh doesn't seem to find existing development profiles generated by xcode. The following is from standard out/error:

Chriss-Air:ios-generic chris$ bundle exec sigh --force --adhoc --app_identifier com.herald.ipad.elnuevo                                     
[10:54:46]: Starting login
[10:54:48]: Successfully logged in
[10:54:48]: Fetching profiles...
[10:54:52]: Found 1 matching profile(s)
[10:54:52]: Updating the profile to include all devices
/Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse': 757: unexpected token at 'HTTP 400 Bad Request' (Faraday::ParsingError)
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response/parse_json.rb:11:in `block in <class:ParseJson>'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:48:in `call'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:48:in `parse'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:39:in `process_response'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:32:in `block in call'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday_middleware-0.10.0/lib/faraday_middleware/response_middleware.rb:30:in `call'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/faraday-0.9.1/lib/faraday/connection.rb:177:in `post'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/spaceship-0.3.2/lib/spaceship/client.rb:214:in `send_request'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/spaceship-0.3.2/lib/spaceship/client.rb:188:in `request'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/spaceship-0.3.2/lib/spaceship/portal/portal_client.rb:276:in `repair_provisioning_profile!'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/spaceship-0.3.2/lib/spaceship/portal/provisioning_profile.rb:344:in `send_update_request'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/spaceship-0.3.2/lib/spaceship/portal/provisioning_profile.rb:360:in `update!'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/sigh-0.10.3/lib/sigh/spaceship/runner.rb:30:in `run'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/sigh-0.10.3/lib/sigh/manager.rb:7:in `start'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/sigh-0.10.3/bin/sigh:36:in `block (2 levels) in run'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:178:in `call'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:178:in `call'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/commander-4.3.4/lib/commander/command.rb:153:in `run'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/commander-4.3.4/lib/commander/runner.rb:428:in `run_active_command'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/commander-4.3.4/lib/commander/runner.rb:68:in `run!'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/commander-4.3.4/lib/commander/delegates.rb:15:in `run!'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/sigh-0.10.3/bin/sigh:88:in `run'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/gems/sigh-0.10.3/bin/sigh:95:in `<top (required)>'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/bin/sigh:23:in `load'
    from /Users/chris/repo/git/ios-generic/vendor/ruby/2.0.0/bin/sigh:23:in `<main>'

Relevant parts of my Gemfile.lock:

GEM
  remote: http://rubygems.org/
  specs:
    activesupport (4.2.3)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.3.8)
    autoparse (0.3.3)
      addressable (>= 2.3.1)
      extlib (>= 0.9.15)
      multi_json (>= 1.0.0)
    awesome_print (1.6.1)
    aws-sdk (1.64.0)
      aws-sdk-v1 (= 1.64.0)
    aws-sdk-v1 (1.64.0)
      json (~> 1.4)
      nokogiri (>= 1.4.4)
    babosa (1.0.2)
    capybara (2.4.4)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    cert (0.3.0)
      fastlane_core (>= 0.9.1)
      spaceship (>= 0.0.10)
    certified (1.0.0)
    claide (0.9.1)
    cliver (0.3.2)
    cocoapods (0.38.2)
      activesupport (>= 3.2.15)
      claide (~> 0.9.1)
      cocoapods-core (= 0.38.2)
      cocoapods-downloader (~> 0.9.1)
      cocoapods-plugins (~> 0.4.2)
      cocoapods-stats (~> 0.5.3)
      cocoapods-trunk (~> 0.6.1)
      cocoapods-try (~> 0.4.5)
      colored (~> 1.2)
      escape (~> 0.0.4)
      molinillo (~> 0.3.1)
      nap (~> 0.8)
      xcodeproj (~> 0.26.3)
    cocoapods-core (0.38.2)
      activesupport (>= 3.2.15)
      fuzzy_match (~> 2.0.4)
      nap (~> 0.8.0)
    cocoapods-downloader (0.9.1)
    cocoapods-plugins (0.4.2)
      nap
    cocoapods-stats (0.5.3)
      nap (~> 0.8)
    cocoapods-trunk (0.6.1)
      nap (>= 0.8)
      netrc (= 0.7.8)
    cocoapods-try (0.4.5)
    coderay (1.1.0)
    colored (1.2)
    commander (4.3.4)
      highline (~> 1.7.2)
    credentials_manager (0.7.0)
      colored
      highline (>= 1.7.1)
      security
    cupertino (1.3.4)
      certified (~> 1.0.0)
      commander (~> 4.3)
      highline (>= 1.7.1)
      mechanize (~> 2.5.1)
      nokogiri (~> 1.6.3)
      security (~> 0.1.2)
      term-ansicolor (~> 1.0.7)
      terminal-table (~> 1.4.5)
    deliver (0.12.1)
      credentials_manager (>= 0.3.0)
      excon
      fastimage (~> 1.6.3)
      fastlane_core (>= 0.7.2)
      nokogiri (~> 1.6.5)
      plist (~> 3.1.0)
      rubyzip (~> 1.1.6)
    domain_name (0.5.24)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.0.2)
    escape (0.0.4)
    excon (0.45.4)
    extlib (0.9.16)
    faraday (0.9.1)
      multipart-post (>= 1.2, < 3)
    faraday_middleware (0.10.0)
      faraday (>= 0.7.4, < 0.10)
    fastimage (1.6.8)
      addressable (~> 2.3, >= 2.3.5)
    fastlane (1.13.0)
      aws-sdk (~> 1.0)
      cert (>= 0.3.0)
      cupertino (>= 1.3.3)
      deliver (>= 0.12.1)
      fastlane_core (>= 0.10.1)
      frameit (>= 2.0.1)
      krausefx-shenzhen (>= 0.14.5)
      nokogiri (~> 1.6)
      pbxplorer (~> 1.0.0)
      pem (>= 0.6.3)
      produce (>= 0.4.1)
      rest-client (~> 1.8.0)
      sigh (>= 0.10.0)
      slack-notifier (~> 1.0)
      snapshot (>= 0.9.0)
      spaceship (>= 0.2.0)
      terminal-notifier (~> 1.6.2)
      terminal-table (~> 1.4.5)
      xcodeproj (~> 0.20)
      xcpretty (~> 0.1)
    fastlane_core (0.11.1)
      babosa
      capybara (~> 2.4.3)
      colored
      commander (>= 4.3.4)
      credentials_manager (>= 0.7.0)
      excon (~> 0.45.0)
      highline (>= 1.7.2)
      json
      multi_json
      phantomjs (~> 1.9.8)
      poltergeist (~> 1.5.1)
      rubyzip (~> 1.1.6)
    frameit (2.1.0)
      deliver (> 0.3)
      fastimage (~> 1.6.3)
      fastlane_core (>= 0.7.2)
      mini_magick (~> 4.0.2)
    fuzzy_match (2.0.4)
    google-api-client (0.8.6)
      activesupport (>= 3.2)
      addressable (~> 2.3)
      autoparse (~> 0.3)
      extlib (~> 0.9)
      faraday (~> 0.9)
      googleauth (~> 0.3)
      launchy (~> 2.4)
      multi_json (~> 1.10)
      retriable (~> 1.4)
      signet (~> 0.6)
    google_drive (1.0.1)
      google-api-client (>= 0.7.0)
      nokogiri (>= 1.4.4, != 1.5.2, != 1.5.1)
      oauth (>= 0.3.6)
      oauth2 (>= 0.5.0)
    googleauth (0.4.1)
      faraday (~> 0.9)
      jwt (~> 1.4)
      logging (~> 2.0)
      memoist (~> 0.12)
      multi_json (= 1.11)
      signet (~> 0.6)
    highline (1.7.2)
    http-cookie (1.0.2)
      domain_name (~> 0.5)
    i18n (0.7.0)
    json (1.8.3)
    jwt (1.5.1)
    krausefx-shenzhen (0.14.5)
      aws-sdk (~> 1.0)
      commander (~> 4.3)
      dotenv (>= 0.7)
      faraday (~> 0.9)
      faraday_middleware (~> 0.9)
      highline (>= 1.7.2)
      json (~> 1.8)
      net-sftp (~> 2.1.2)
      plist (~> 3.1.0)
      rubyzip (~> 1.1)
      security (~> 0.1.3)
      terminal-table (~> 1.4.5)
    launchy (2.4.3)
      addressable (~> 2.3)
    little-plugger (1.1.3)
    logging (2.0.0)
      little-plugger (~> 1.1)
      multi_json (~> 1.10)
    mechanize (2.5.1)
      domain_name (~> 0.5, >= 0.5.1)
      mime-types (~> 1.17, >= 1.17.2)
      net-http-digest_auth (~> 1.1, >= 1.1.1)
      net-http-persistent (~> 2.5, >= 2.5.2)
      nokogiri (~> 1.4)
      ntlm-http (~> 0.1, >= 0.1.1)
      webrobots (~> 0.0, >= 0.0.9)
    memoist (0.12.0)
    method_source (0.8.2)
    mime-types (1.25.1)
    mini_magick (4.0.4)
    mini_portile (0.6.2)
    minitest (5.7.0)
    molinillo (0.3.1)
    multi_json (1.11.0)
    multi_xml (0.5.5)
    multipart-post (2.0.0)
    nap (0.8.0)
    net-http-digest_auth (1.4)
    net-http-persistent (2.9.4)
    net-sftp (2.1.2)
      net-ssh (>= 2.6.5)
    net-ssh (2.9.2)
    netrc (0.7.8)
    nokogiri (1.6.6.2)
      mini_portile (~> 0.6.0)
    ntlm-http (0.1.1)
    oauth (0.4.7)
    oauth2 (1.0.0)
      faraday (>= 0.8, < 0.10)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (~> 1.2)
    pbxplorer (1.0.0)
    pem (0.6.4)
      fastlane_core (>= 0.7.2)
    phantomjs (1.9.8.0)
    plist (3.1.0)
    poltergeist (1.5.1)
      capybara (~> 2.1)
      cliver (~> 0.3.1)
      multi_json (~> 1.0)
      websocket-driver (>= 0.2.0)
    produce (0.4.3)
      fastlane_core (>= 0.7.6)
      spaceship (>= 0.3.0)
    pry (0.10.1)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rest-client (1.8.0)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 3.0)
      netrc (~> 0.7)
    retriable (1.4.1)
    rubyzip (1.1.7)
    security (0.1.3)
    sigh (0.10.3)
      fastlane_core (>= 0.10.1)
      plist (~> 3.1.0)
      spaceship (>= 0.0.14)
    signet (0.6.1)
      addressable (~> 2.3)
      extlib (~> 0.9)
      faraday (~> 0.9)
      jwt (~> 1.5)
      multi_json (~> 1.10)
    slack-notifier (1.2.1)
    slop (3.6.0)
    snapshot (0.9.2)
      fastimage (~> 1.6.3)
      fastlane_core (>= 0.7.2)
    spaceship (0.3.2)
      credentials_manager (>= 0.5.0)
      faraday (~> 0.9)
      faraday_middleware (~> 0.9)
      multi_xml (~> 0.5)
      plist (~> 3.1)
    term-ansicolor (1.0.7)
    terminal-notifier (1.6.3)
    terminal-table (1.4.5)
    thread_safe (0.3.5)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.1)
    webrobots (0.1.1)
    websocket-driver (0.6.2)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    xcodeproj (0.26.3)
      activesupport (>= 3)
      claide (~> 0.9.1)
      colored (~> 1.2)
    xcpretty (0.1.10)
    xml-simple (1.1.5)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  awesome_print
  cocoapods
  cupertino
  deliver
  fastlane
  google-api-client
  google_drive
  pry
  sigh
  snapshot
  xml-simple

BUNDLED WITH
   1.10.5
chrisperelstein commented 9 years ago

I'm becoming convinced that my issue is actually firewall related. I consistently see this issue at work, but not at home or tethered to my phone.

KrauseFx commented 9 years ago

@chrisperelstein not finding the Xcode profiles is by design, as the Xcode managed profiles don't work usually. That means sigh will manage its own set of profiles without touching or using the Xcode managed profiles