0

We have a server that generates signed URLs for images at various sizes and hands them off to the client. The web client does javascript goodness tries to upload three different sizes of the same images to the signed URLs provided by the server.

<Error>
  <Code>AccessDenied</Code>
  <Message>Access denied.</Message>
  <Details>Anonymous users does not have storage.objects.create access to bucket your-bucket-name.</Details>
</Error>

We have confirmed that the server code can upload images successfully and we can upload via gsutil with the same permissions.

Here is a snippet of our very spikey JS code that is trying to send the image to GCS.

  var blobData = dataURItoBlob(canvas.toDataURL('image/png'));

  jQuery.ajax({
    type: 'PUT',
    url: signedURL,
    contentType: 'image/png',
    processData: false,
    data: blobData
  })

Hopefully someone can point us in the right direction!

1 Answers1

0

Is the response a 401 or a 403? If it's a 401, the query parameters are probably not present for some reason. This is commonly because your program may accidentally double-escaping the URL or otherwise stripping the query parameters. Check the value of signedURL.

Brandon Yarbrough
  • 37,021
  • 23
  • 116
  • 145
  • Ugh! That was absolutely it. I saw something in the first part of the URL that made me think it wasn't double escaping but it was double escaping the ampersands. Thanks for that, looking more closely was all it took! – Morgan Whitney Jun 28 '17 at 17:11