Following this article and getting this error. Using python to sign the policy doc

InvalidPolicyDocumentInvalid Policy: Invalid JSON.xxxxxxxxCD2EI80iQvdVKMvl8mrMKDG62Obva4jddKQhNGDPCstjDd

This is my doc:

    "conditions": [
        {"bucket": "somebucket"},
        {"acl": "private"},
        {"success_action_redirect": "http://www.foo.com/"},
    "expiration": "2014-01-01T00:00:00Z"

I know that it's a valid JSON!

  • Valid JSON, okay, but what's all of that base-64-looking "line noise" in the error message? Does that suggest the think you think you're sending isn't the actual thing you're sending? – Michael - sqlbot Nov 3 '13 at 17:04
  • Did you ever figure this out? – Collin Aug 24 '15 at 14:17
  • I have not tested this, but it's possible that the policy parser is rejecting the empty string. I suspect this because it also rejects decimal numbers with the same "Invalid JSON" message. – Collin Aug 25 '15 at 18:41

This is indeed a valid json, but doesn't look like a valid policy doc. What guide did you follow building it? Your link seems to be broken/unattached.

As far as I remember:

  • conditions list not a valid item in policy, use statement list instead
  • conditions for a given statement are represedted as key: value elements of condition dictionary

Look for samples here and there. Also, you might find handy Amazon policy generator.

| improve this answer | |

Your Answer

