URGENT: Document uploads fail with status 400

26 views
Skip to first unread message

Christoph Z.

unread,
May 8, 2010, 5:39:58 PM5/8/10
to Google Data APIs Objective-C Client Library Discussion
Hi,

I've posted this question already on the Document List API forum
(where it seems to belong), but just in case this is related to some
protocol changes which aren't implemented in the obj-c API yet, I'm
posting it here as well.

As of couple of days ago (or so), document uploads fail (most of the
time) with status 400. Occasionally they do succeed though, but very
rarely (at least today). I've tested couple of accounts and got
numerous support cases from users hitting this problem in our iPhone
app.

Here's an example of the request/response. This code worked without
any problems for months. Is this a know issue that's being
investigated? Has something changed that will require a code change?
Are there any workarounds?

Any help is much appreciated as this affects our users in production.

Thanks,
Christoph


:: REQUEST

POST URL:
http://docs.google.com/feeds/default/private/full/folder%3A0BzTjld1CzbTuZTc2NGUwNzAtNjEwOC00MzdlLWJkZmYtNjZjODkyZWNhYzJm/contents

{
Accept = "application/atom+xml, text/xml";
Authorization = "GoogleLogin auth=xxx";
"Cache-Control" = "no-cache";
"Content-Length" = 538;
"Content-Type" = "multipart/related; boundary=\"END_OF_PART\"";
"Gdata-Version" = "3.0";
"Mime-Version" = "1.0";
"User-Agent" = "GData-ObjectiveC/1.10 iPhone_Simulator/3.1.3
(gzip)";
}


--END_OF_PART
Content-Type: application/atom+xml; charset=UTF-8

<entry xmlns:gd="http://schemas.google.com/g/2005" xmlns:app="http://
www.w3.org/2007/app" xmlns:docs="http://schemas.google.com/docs/2007"
xmlns="http://www.w3.org/2005/Atom"><title>Bar</title><category
term="http://schemas.google.com/docs/2007#document" scheme="http://
schemas.google.com/g/2005#kind"/><published>2010-05-08T14:13:33-07:00</
published></entry>
--END_OF_PART
Content-Transfer-Encoding: binary
Content-Type: text/plain

Some text.
--END_OF_PART--


:: RESPONSE

status: 400

{
"Cache-Control" = "private, max-age=0";
"Content-Encoding" = gzip;
"Content-Type" = "application/vnd.google.gdata.error+xml";
Date = "Sat, 08 May 2010 21:15:58 GMT";
Expires = "Sat, 08 May 2010 21:15:58 GMT";
Server = GSE;
"Transfer-Encoding" = Identity;
"X-Content-Type-Options" = nosniff;
"X-Frame-Options" = SAMEORIGIN;
"X-Xss-Protection" = "1; mode=block";
}

<errors xmlns='http://schemas.google.com/g/2005'>
<error>
<domain>GData</domain>
<code>InvalidEntryException</code>
<internalReason>Could not convert document.</internalReason>
</error>
</errors>

--
You received this message because you are subscribed to the Google Groups "Google Data APIs Objective-C Client Library Discussion" group.
To post to this group, send email to gdata-objec...@googlegroups.com.
To unsubscribe from this group, send email to gdata-objectivec-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gdata-objectivec-client?hl=en.

Greg Robbins

unread,
May 8, 2010, 7:10:47 PM5/8/10
to gdata-objec...@googlegroups.com
Your upload is being done with the older multipart MIME upload protocol, rather than the newer chunked protocol, but the old protocol should continue to work.

When I try to reproduce this with the DocsSample application, I'm seeing timeouts (CFNetwork error -1001). With the library's automatic retry on, and under chunked uploads, the library's retry attempt is correctly requesting the position from which to upload the next chunk (a PUT with header Content-Range = "bytes */7") and the upload server is sending back the status 400, "Could not convert document"

With chunked uploads disabled, as is shown in your message (that is, the upload body is multipart/related), I'm just seeing the timeout, CFNetwork error -1001. The library can't successfully retry multipart uploads because it builds them with NSInputStream, but that doesn't affect chunked uploads.

In any case, I suspect you're seeing a problem with timeouts from the server. Does that mesh with your http logs of the problem?

Greg Robbins

unread,
May 8, 2010, 7:31:22 PM5/8/10
to gdata-objec...@googlegroups.com
I've opened a bug internally for the Docs API team (2669039).

Greg Robbins

unread,
May 8, 2010, 7:38:03 PM5/8/10
to gdata-objec...@googlegroups.com
This is on the public issue tracker as http://code.google.com/p/gdata-issues/issues/detail?id=2061

Plus add a star to that issue to be notified of changes.

Christoph Z.

unread,
May 8, 2010, 11:17:26 PM5/8/10
to Google Data APIs Objective-C Client Library Discussion
Hi Greg,

Thanks for the follow up. Most of the time when I hit this issue, I
was getting status 400, however I've seen timeouts (-1001) as well.

Here are the relevant chunks of code which demonstrate precisely how
we upload text files. By the way, since these are typically short
notes (taken on an iPhone), we decided against chunked uploads to
reduce the number of server round-trips.

GDataServiceGoogleDocs* service = [[[GDataServiceGoogleDocs alloc]
init] autorelease];

[service setUserAgent:kGoogleUserAgent];
[service setShouldCacheDatedData:NO];
[service setServiceShouldFollowNextLinks:YES];
[service setIsServiceRetryEnabled:YES];
[service setServiceUploadChunkSize:0];
[service setUserCredentialsWithUsername:username
password:password];

// ...

remoteEntry = [GDataEntryStandardDoc documentEntry];
[remoteEntry setTitleWithString:title];
[remoteEntry setPublishedDate:[GDataDateTime
dateTimeWithDate:localDocument.date timeZone:calendar.timeZone]];
[remoteEntry setUploadData:uploadData];
[remoteEntry setUploadMIMEType:@"text/plain"];

postURL = [[self.syncedFolderFeed postLink] URL];

self.ticket = [service fetchEntryByInsertingEntry:remoteEntry
forFeedURL:postURL delegate:self

didFinishSelector:@selector(remoteInsertTicket:finishedWithEntry:error:)];

Have a great day!
-Christoph
Reply all
Reply to author
Forward
0 new messages