Problems With blobstore.ParseUpload()

305 views
Skip to first unread message

Dwayne Harris

unread,
Oct 30, 2011, 6:59:12 PM10/30/11
to google-ap...@googlegroups.com
When running on the dev_appserver (SDK 1.5.5 on Mac OS 10.7), whenever I try to use the blobstore.ParseUpload function, the err value returned is:

blobstore: error reading next mime part with boundary "===============0018153050==" (len=27): multipart: NextPart: EOF

This is when trying to upload a jpg image. The blob is actually created in the simulated datastore, so when I check the __BlobInfo__ entities, I see the key, the image/jpeg content_type, the correct creation and filename properties and the correct file size. But after the internal redirect to my handler, I get the error.

Any ideas why this is happening?

Brad Fitzpatrick

unread,
Oct 31, 2011, 2:57:57 PM10/31/11
to google-ap...@googlegroups.com
What browser?  How many jpegs?  Just 1?  Can you email me one that fails?

And maybe email me sample code that fails, too?

Dwayne Harris

unread,
Nov 1, 2011, 1:01:16 AM11/1/11
to google-ap...@googlegroups.com
Hey, I just tried it tonight on Safari, Firefox, and Chrome and with 4 different images (three jpg and 1 png). All combinations gave me the same error. Here's some of the code I'm using:

/account/ .html page:

--
<form action="{{.UploadURL}}" method="post" enctype="multipart/form-data">
<table>
<tr>
<th><label for="image">Image</label></th>
<td><input type="file" name="image" id="form-image"></td>
</tr>
--

/account/ Handler (before post):

--
uploadURL, err := blobstore.UploadURL(c, "/account/", nil)
if err != nil {
RenderErrorPage(c, w, err, err.String())
return
}

tc := &accountTemplateContext{ Messages: []string{}, UploadURL: uploadURL.Raw }
--

/account/ Handler (during post):

--
if r.Method == "POST" {
blobs, values, err := blobstore.ParseUpload(r)
if err != nil {
RenderErrorPage(c, w, err, err.String())
return
}
-- 

David Symonds

unread,
Nov 1, 2011, 8:11:24 AM11/1/11
to google-ap...@googlegroups.com
On Tue, Nov 1, 2011 at 4:01 PM, Dwayne Harris <dwa...@gmail.com> wrote:

> tc := &accountTemplateContext{ Messages: []string{}, UploadURL:
> uploadURL.Raw }

Have you tried using just "uploadURL" here (and adjusting the
accountTemplateContext field's type), or "uploadURL.String()" (if you
don't want to change other code)?


Dave.

Dwayne Harris

unread,
Nov 1, 2011, 7:59:33 PM11/1/11
to google-ap...@googlegroups.com
Hey Dave,

I used the String() method so my code looked like this:

--
UploadURL: uploadURL.String()
--

I still got the same result.

Brad Fitzpatrick

unread,
Nov 2, 2011, 2:01:07 PM11/2/11
to google-ap...@googlegroups.com
If you give me a self-contained sample app, I will fix it.

I can't work off snippets, though.  It seems to work for me.

Dwayne Harris

unread,
Nov 3, 2011, 9:45:19 AM11/3/11
to google-ap...@googlegroups.com
Okay. In order for me to give you a self-contained sample I would basically have to write something new. Thanks for your help though.

Does anyone else have any ideas? After more testing I determined that the error is coming up even if I don't upload a file (and comes up before I'm even able to check if anything was uploaded at all). I also tested removing anything that accesses the http.Request variable before the call to blobstore.ParseUpload() (besides appengine.NewContext()).

Dwayne Harris

unread,
Nov 11, 2011, 1:10:52 AM11/11/11
to google-ap...@googlegroups.com
So I was hoping maybe 1.6.0 would fix this issue, but it hasn't. I know using the blobstore is working for some people, but I'm still getting this error. Can anyone tell me ANY reason why this error would be returned? To summarize:

- It happens whether I actually select an image or not
- It happens on Safari, Firefox, and Chrome
- I have only tested so far on the dev server (on Mac OS 10.7.2)

Again, the error:

blobstore: error reading next mime part with boundary "===============0018153050==" (len=27): multipart: NextPart: EOF

Thanks.

David Symonds

unread,
Nov 11, 2011, 1:19:11 AM11/11/11
to google-ap...@googlegroups.com
On Fri, Nov 11, 2011 at 5:10 PM, Dwayne Harris <dwa...@gmail.com> wrote:

> So I was hoping maybe 1.6.0 would fix this issue, but it hasn't. I know
> using the blobstore is working for some people, but I'm still getting this
> error. Can anyone tell me ANY reason why this error would be returned? To
> summarize:
> - It happens whether I actually select an image or not
> - It happens on Safari, Firefox, and Chrome
> - I have only tested so far on the dev server (on Mac OS 10.7.2)

It would be informative to know whether you can reproduce this in
production. Can you give that a try?


Dave.

Brad Fitzpatrick

unread,
Nov 16, 2011, 8:52:19 PM11/16/11
to google-ap...@googlegroups.com
I believe that you're getting an error and I'm sure there's a bug on our side, but it can't be fixed if we can't reproduce it.  Sample code to reproduce it would be awesome.

afe...@google.com

unread,
Apr 16, 2012, 12:49:31 AM4/16/12
to google-ap...@googlegroups.com
This just bit me after updating gae, and I solved it for my own app. The problem is that http.Request.ParseForm() appears to not, in fact, be idempotent.

where r is an http.Request:

foo := r.FormValue("a_field") // At some point, this calls r.ParseForm().
blobs, _, err := blobstore.ParseUpload(r) // Fails.

Reversing the order of the lines, such that blobstore.ParseUpload() happens before http.Request.ParseForm() fixed my app.

David Symonds

unread,
Apr 16, 2012, 2:17:07 AM4/16/12
to afe...@google.com, google-ap...@googlegroups.com
On Mon, Apr 16, 2012 at 2:49 PM, <afe...@google.com> wrote:

> This just bit me after updating gae, and I solved it for my own app. The
> problem is that http.Request.ParseForm() appears to not, in fact, be
> idempotent.

It's idempotent, but that's not what you mean, or tripped over.
ParseForm modifies the request, so blobstore.ParseUpload can not read
the HTTP body.


Dave.

Reply all
Reply to author
Forward
0 new messages