fastlane: 784/776: unexpected token at 'Bad Request' (Faraday::ParsingError)

New Issue Checklist

Issue Description

Complete output when running fastlane, including the stack trace and command used

Run the "fastlane pem " command I get the error:

[[10:35:29]: The bundle identifier of your app: 
[10:35:39]: Creating a new push certificate for app ''.

Looking for related GitHub issues on fastlane/fastlane…

➡️ [Regression] 784: unexpected token at ‘Bad Request’ reintroduced in 2.19 https://github.com/fastlane/fastlane/issues/8409 [closed] 4 💬 19 Sep 2017

➡️ 784: unexpected token at ‘Bad Request’ https://github.com/fastlane/fastlane/issues/5903 [closed] 6 💬 04 Feb 2017

➡️ PEM [!] 784: unexpected token at ‘Bad Request’ https://github.com/fastlane/fastlane/issues/5849 [closed] 3 💬 06 Dec 2016

and 6 more at: https://github.com/fastlane/fastlane/search?q=784%3A unexpected token at 'Bad Request'&type=Issues&utf8=✓

🔗 You can ⌘ + double-click on links to open them directly in your browser. /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/2.3.0/json/common.rb:156:in parse': [!] 784: unexpected token at 'Bad Request' (Faraday::ParsingError) from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/2.3.0/json/common.rb:156:in parse’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response/parse_json.rb:11:in block in <class:ParseJson>' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:51:in parse’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:40:in process_response' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:33:in block in call’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.15.3/lib/faraday/response.rb:61:in on_complete' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday_middleware-0.12.2/lib/faraday_middleware/response_middleware.rb:31:in call’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.15.3/lib/faraday/rack_builder.rb:143:in build_response' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.15.3/lib/faraday/connection.rb:387:in run_request’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.15.3/lib/faraday/connection.rb:175:in post' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/spaceship/lib/spaceship/client.rb:701:in block in send_request’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/spaceship/lib/spaceship/client.rb:533:in with_retry' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/spaceship/lib/spaceship/client.rb:700:in send_request’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/spaceship/lib/spaceship/client.rb:586:in request' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/spaceship/lib/spaceship/portal/portal_client.rb:574:in create_certificate!’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/spaceship/lib/spaceship/portal/certificate.rb:305:in create!' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/pem/lib/pem/manager.rb:49:in create_certificate’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/pem/lib/pem/manager.rb:33:in start' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/pem/lib/pem/commands_generator.rb:37:in block (2 levels) in run’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in call' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in run’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in run_active_command' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in run!’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in run!' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/pem/lib/pem/commands_generator.rb:43:in run’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/pem/lib/pem/commands_generator.rb:15:in start' from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/fastlane/lib/fastlane/cli_tools_distributor.rb:100:in take_off’ from /Users/Phuong/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/fastlane-2.105.2/bin/fastlane:20:in <top (required)>' from /Users/Phuong/.rbenv/versions/2.3.3/bin/fastlane:22:in load’ from /Users/Phuong/.rbenv/versions/2.3.3/bin/fastlane:22:in `<main>’ Apples-MacBook-Air:~ Phuong$

Environment

✅ fastlane environment ✅

Stack

Key Value
OS 10.11.6
Ruby 2.3.3
Bundler? false
Git git version 2.10.1 (Apple Git-78)
Installation Source ~/.rbenv/versions/2.3.3/bin/fastlane
Host Mac OS X 10.11.6 (15G22010)
Ruby Lib Dir ~/.rbenv/versions/2.3.3/lib
OpenSSL Version OpenSSL 1.0.2l 25 May 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Library/Developer/CommandLineTools/
Xcode Version

System Locale

Variable Value
LANG en_US.UTF-8
LC_ALL
LANGUAGE

fastlane files:

No Fastfile found

No Appfile found

fastlane gems

Gem Version Update-Status
fastlane 2.108.0 ✅ Up-To-Date

Loaded fastlane plugins:

No plugins Loaded

Loaded gems
Gem Version
did_you_mean 1.0.0
slack-notifier 2.3.2
atomos 0.1.3
CFPropertyList 3.0.0
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.6
xcodeproj 1.6.0
rouge 2.0.7
xcpretty 0.3.0
terminal-notifier 1.8.0
unicode-display_width 1.4.0
terminal-table 1.8.0
plist 3.4.0
public_suffix 2.0.5
addressable 2.5.2
multipart-post 2.0.0
word_wrap 1.0.0
tty-screen 0.6.5
tty-cursor 0.6.0
tty-spinner 0.8.0
babosa 1.0.2
colored 1.2
highline 1.7.10
commander-fastlane 4.4.6
excon 0.62.0
faraday 0.15.3
unf_ext 0.0.7.5
unf 0.1.4
domain_name 0.5.20180417
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
fastimage 2.1.4
gh_inspector 1.1.3
json 1.8.3
mini_magick 4.5.1
multi_json 1.13.1
multi_xml 0.6.0
rubyzip 1.2.2
security 0.1.3
xcpretty-travis-formatter 1.0.0
dotenv 2.5.0
bundler 1.16.5
faraday_middleware 0.12.2
naturally 2.2.0
simctl 1.6.5
uber 0.1.0
declarative 0.0.10
declarative-option 0.1.0
representable 3.0.4
retriable 3.1.2
mime-types-data 3.2018.0812
mime-types 3.2.2
jwt 2.1.0
signet 0.9.2
memoist 0.16.0
os 1.0.0
googleauth 0.6.6
httpclient 2.8.3
google-api-client 0.23.9
emoji_regex 0.1.1
io-console 0.4.5
psych 2.1.0

generated on:* 2018-11-12*

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 56 (23 by maintainers)

Most upvoted comments

I noticed that retrying a previous request that got a 200 OK before now was returning a 421. Just replacing the CSRF token didn’t do anything this time, but I noticed that the response to the 421 also included a Set-Cookie that replaced the DSESSIONID value of the cookie. After replacing this as well, the request returned a 200 OK again.

@janpio, Russia, Moscow

Baby steps… but I think I got it:

Changing the csrf header value of a working request triggers the 421 error code! But the response actually includes a new CSRF token. If I use that to repeat the same request, I get a 200 OK again. That would mean, that for whatever reason, your CSRF tokens are invalid when you make the request. But this should be recoverable by using the new CSRF token the response returns.

The CSRF tokens seem to be bound to a cookie (DSESSIONID, myacinfo), which of course makes sens eas it was created/requested with that cookie information.

Hi @janpio these are the last strings of my last spaceship log:

[13:36:28]: >> POST: account/ios/profile/deleteProvisioningProfile.action {teamId: *********}, {provisioningProfileId: *********}
[13:36:29]: Timeout received: '765: unexpected token at 'Bad Request''. Retrying after 3 seconds (remaining: 4)...
[13:36:32]: Timeout received: '765: unexpected token at 'Bad Request''. Retrying after 3 seconds (remaining: 3)...
[13:36:36]: Timeout received: '765: unexpected token at 'Bad Request''. Retrying after 3 seconds (remaining: 2)...
[13:36:40]: Timeout received: '765: unexpected token at 'Bad Request''. Retrying after 3 seconds (remaining: 1)...

@janpio I’m travelling in India and got the problem some hours ago. Now I’ve just tried with a VPN with italian IP (usually I work from there) and it works.

I 'm from Hanoi, Vietnam

I have a similar issue. I’m running match adhoc with very long list of app_identifiers Only one or two provisions are created, then failed ...fastlane/bin/bundle/lib/ruby/2.2.0/json/common.rb:155:in 'parse': [!] 776: unexpected token at 'Bad Request' (Faraday::ParsingError) fastlane 2.108.0

November 7th everything worked fine (older fastlane version, I can not specify which)

It seems that the problems are on the Apple’s side