Tailored Audience files uploads failing - 411 length required


This started happening on our Ad account. We created a campaign via TweetSharp Api using a Ad Account / @Monster and targeted audience as we normally would do.

Campaign started to fail, after the investigation the issue seems to be caused by invalid Tailored audience files. We have an automated upload mechanism and that started to fail which is resulting our campaigns targeting invalid TA’s

This has never happened before. Looking at the issue from the TA upload, it was first throwing a 411 length required error in the response and now it’s throwing the following:

“The remote server returned an error: (400) Bad Request.”

Response URI : {https://ton.twitter.com/1.1/ton/bucket//ta_partner?resumable=true}

Status : BadRequest
StatusDescription : “Bad Request”

This causing a huge number of campaigns to fail on our side, has anything changed on twitter?

The last successful upload was:
2017-12-11 20:28:29.508-05:00 INFO: Downloading s3 file tbprs_email_469_twitter_Recruiting_Staffing_Hiring to C:\Windows\TEMP\tmp9DA3.tmp
2017-12-11 20:28:29.727-05:00 INFO: Downloaded 481536 of 481536 bytes (100 %)

Started to see failures on:

2017-12-15 10:19:17.212-05:00 INFO: [RetryManager] [UploadTailoredAudienceDataStreamToSocialNetwork] Init: 0 / 2 max attempts.
2017-12-15 10:19:17.212-05:00 INFO: Uploading hashed data to Twitter - try #1
2017-12-15 10:19:17.727-05:00 ERROR: [RetryManager] [UploadTailoredAudienceDataStreamToSocialNetwork] Action threw exception:

TwitterApi.TwitterApiException: Error with UploadToTON
at SocialJobs.Twitter.TwitterServiceWrapper.TwitterUploadFileToTON(String bucketName, String fileName, String contentType, Boolean isHashed) in …\SocialJobs\Twitter\TwitterServiceWrapper.cs:line 268
at ORM.Manager.Ads.CustomAudience.TwitterTailoredAudienceFileManager.<>c__DisplayClass17_0.b__0() in …\Components\SocialJobs\ORM\Manager\Ads\CustomAudience\TwitterTailoredAudienceFileManager.cs:line 84
at …Utilities.Retries.RetryManager.TryAction(Action action, Func`2 isRetryableFunc) in …\Components\BGW\Batch\Utilities\Retries\RetryManager.cs:line 120
2017-12-15 10:19:17.727-05:00 WARNING: [RetryManager] [UploadTailoredAudienceDataStreamToSocialNetwork] Attempt failed. Count is now 1 / 2. Caller should retry attempt.
2017-12-15 10:19:17.727-05:00 ERROR: TwitterService or TwitterService.Response is null. This is a bad error, stopping


@apocalypse3: It sounds like you’re having trouble with uploading the file data—using the TON API with the ta_partner bucket. To debug this, let’s work with the same tools to ensure we eliminate any exogenous factors. Please make the request using twurl and specify the -t flag. If the request is unsuccessful, please share the entire response, including the response headers.

Here is an example request. (See this post for details on uploading file data.)

$ twurl -t -X POST -H ton.twitter.com "/1.1/ton/bucket/ta_partner" -d "$(<hashed_user_ids.txt)" --header "Content-Type: text/plain" --header "X-TON-Expires: Wed, 27 Dec 2017 06:01:00 GMT"
opening connection to ton.twitter.com:443...
starting SSL for ton.twitter.com:443...
SSL established
<- "POST /1.1/ton/bucket/ta_partner HTTP/1.1\r\nContent-Type: text/plain\r\nX-Ton-Expires: Wed, 27 Dec 2017 06:01:00 GMT\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: OAuth gem v0.5.1\r\nAuthorization: OAuth oauth_body_hash=\"zL7Uufynw2Nfev55yXI3vMuwd1Q%3D\", oauth_consumer_key=\"DRbmz6DzIBzwXot02nWBUpDkM\", oauth_nonce=\"EfmbLEC3nGHNHSYNfFNBE9TrEM9GxSvE4A7DW6LMc\", oauth_signature=\"ksuEIR6dgIOA2DbzYWvoiO512QA%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1514267380\", oauth_token=\"2417045708-7XhYltQvARpzoozxRvlgdd5B7Vy0hcwUFwIf3UL\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: ton.twitter.com\r\nContent-Length: 163929\r\n\r\n"
<- ...
-> "HTTP/1.1 201 Created\r\n"
-> "connection: close\r\n"
-> "content-length: 0\r\n"
-> "content-type: text/plain\r\n"
-> "date: Tue, 26 Dec 2017 05:49:35 GMT\r\n"
-> "location: /1.1/ton/data/ta_partner/2417045708/4lrNX7Z8GI7pX0f.txt\r\n"
-> "server: tsa_a\r\n"
-> "set-cookie: personalization_id=\"v1_6/iEGvnhPgVtro07k8UX4A==\"; Expires=Thu, 26 Dec 2019 05:49:35 UTC; Path=/; Domain=.twitter.com\r\n"
-> "set-cookie: guest_id=v1%3A151426737548435640; Expires=Thu, 26 Dec 2019 05:49:35 UTC; Path=/; Domain=.twitter.com\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-connection-hash: e36ef1c89bd32dcd12c13651b6e7494a\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-rate-limit-limit: 90000\r\n"
-> "x-rate-limit-remaining: 89997\r\n"
-> "x-rate-limit-reset: 1514267472\r\n"
-> "x-response-time: 45\r\n"
-> "x-tsa-request-body-time: 231\r\n"
-> "\r\n"
reading 0 bytes...
-> ""
read 0 bytes
Conn close

Note that the file data was successfully uploaded.


@apocalypse3: Please let us know if you were able to successfully upload file data for a tailored audience.