1

I currently use Google Cloud Storage with paperclip for image uploads. Everything works fine and my credentials are valid.

I now wish to generate a signed URL on Google Cloud Storage to give to users.

First I create a storage object:

storage = Fog::Storage.new(
        provider: "Google",
        google_storage_access_key_id: "KNOWN_GOOD_ID",
        google_storage_secret_access_key: "KNOWN_GOOD_KEY")

Then I create the URL:

storage.put_object_url("MY_BUCKET",
        "RANDOM_NAME.jpg",
        1.hour,
        'Content-Type' => 'image/jpeg')

Which return https://storage.googleapis.com/MY_BUCKET/RANDOM_NAME.jpg?GoogleAccessId=REDACTED&Signature=REDACTED&Expires=3600

In the past, if I temporarily enabled AllUsers:W (just temporarily!), I was able to POST a binary image (via Postman API client) to this bucket.

However, when I try to POST a jpeg file to the bucket now, I get this error:

<?xml version='1.0' encoding='UTF-8'?>
<Error>
    <Code>InvalidPolicyDocument</Code>
    <Message>The content of the form does not meet the conditions specified in the policy document.</Message>
    <Details>Missing policy</Details>
</Error>

How do I resolve this Missing policy error?

Rick
  • 8,366
  • 8
  • 47
  • 76

0 Answers0