dabit3 / appsync-auth-and-unauth

How to allow both authenticated & unauthenticated access to an API
90 stars 2 forks source link

Getting ` The policy failed legacy parsing ` error. #3

Open idkjs opened 5 years ago

idkjs commented 5 years ago

Greetings,

I figured I would try to implement this on this aws-example.

After installing and running it successfully, I followed the steps in this repo.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "appsync:GraphQL" ], "Resource": [ "arn:aws:appsync:eu-west-1:073051392232:apis/gucbk3owp5h4dihdqd2qdiqbwa/types/Query/fields/listPictures" ] } ] }```

"Authenticated role" throws following error

An error occurred
Your request has a problem. Please see the following details.

    The policy failed legacy parsing 

When trying this json:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "appsync:GraphQL"
            ],
            "Resource": [
                "arn:aws:appsync:eu-west-1:073051392232:apis/gucbk3owp5h4dihdqd2qdiqbwa/types/Query/fields/listPictures",
                "arn:aws:appsync:eu-west-1:073051392232:apis/gucbk3owp5h4dihdqd2qdiqbwa/types/Mutation/fields/createPicture"
            ]
        }
    ]
}

Searched around on stackoverflow and web but cant find what the proper format should be to fix the parsing error.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "appsync:GraphQL"
            ],
            "Resource": [
                "arn:aws:appsync:eu-west-1:073051392232:apis/gucbk3owp5h4dihdqd2qdiqbwa/types/Query/fields/listPictures",
                "arn:aws:appsync:eu-west-1:073051392232:apis/gucbk3owp5h4dihdqd2qdiqbwa/types/Mutation/fields/createPicture"
            ]
        }
    ]
}

Any guidance would be greatly appreciated. Thank you.

JakeBarron commented 4 years ago

I have this same bug. Would love to hear some thoughts. When I replace the the Resource array with a string I get no errors, but I need the same configs as @idkj . Thanks