cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unexpected Rest Get snap behaviour

macfer
New Contributor

We have created a pipeline where we are using rest POST snap to run the job and rest GET to poll for job status until success (using has and hasNext properties).
APIs are created in AWS API Gateway and both paths have IAM authorisation set.

Observing some strange behaviour where sometimes the pipelines execute without any error (job run and wait till job success and continue rest of pipeline), other time returns 2 or 3* 200 responses (running state) but throws 403 error after some time

[
    {
        "error": "REST API service endpoint returned error result: status code = 403, reason phrase = Forbidden",
        "stacktrace": "com.snaplogic.snap.api.SnapDataException: REST API service endpoint returned error result: status code = 403\n\tat com.snaplogic.snap.api.rest.RestResponseProcessor.process(RestResponseProcessor.java:379)\n\tat com.snaplogic.snap.api.rest.RestRequestExecutor.execute(RestRequestExecutor.java:426)\n\tat com.snaplogic.snap.api.rest.RestRequestExecutor.executeOnce(RestRequestExecutor.java:323)\n\tat com.snaplogic.snap.api.rest.RestRequestExecutor.execute(RestRequestExecutor.java:190)\n\tat com.snaplogic.snap.api.rest.RestRequestExecutor.execute(RestRequestExecutor.java:173)\n\tat com.snaplogic.snaps.rest.Get.process(Get.java:152)\n\tat com.snaplogic.snap.api.ExecutionUtil.process(ExecutionUtil.java:106)\n\tat com.snaplogic.snap.api.ExecutionUtil.executeForDocument(ExecutionUtil.java:118)\n\tat com.snaplogic.snap.api.ExecutionUtil.execute(ExecutionUtil.java:81)\n\tat com.snaplogic.snap.api.SimpleSnap.execute(SimpleSnap.java:70)\n\tat com.snaplogic.snaps.rest.Get.executeForSuggest(Get.java:196)\n\tat com.snaplogic.cc.snap.common.SnapRunnableImpl.executeSnap(SnapRunnableImpl.java:807)\n\tat com.snaplogic.cc.snap.common.SnapRunnableImpl.executeForSuggest(SnapRunnableImpl.java:648)\n\tat com.snaplogic.cc.snap.common.SnapRunnableImpl.doRun(SnapRunnableImpl.java:865)\n\tat com.snaplogic.cc.snap.common.SnapRunnableImpl.call(SnapRunnableImpl.java:436)\n\tat com.snaplogic.cc.snap.common.SnapRunnableImpl.call(SnapRunnableImpl.java:120)\n\tat java.base/java.util.concurrent.FutureTask.run(Unknown Source)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)\n\tat java.base/java.util.concurrent.FutureTask.run(Unknown Source)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\n\tat java.base/java.lang.Thread.run(Unknown Source)\n",
        "reason": "REST API service endpoint returned error result: status code = 403, reason phrase = Forbidden, refer to the error_entity field in the error view document for more details",
        "resolution": "Please check the values of Snap properties.",
        "status_code": "error",
        "headers": {
            "content-length": "23",
            "content-type": "application/json",
            "date": "Fri, 12 May 2023 06:04:49 GMT",
            "apigw-requestid": "Ey6WgqeIMEMYQ=",
            "connection": "keep-alive"
        },
        "error_entity": "{\"message\":\"Forbidden\"}",
        "request_headers": [
            {
                "authorization": "AWS4-HMAC-SHA256 *****",
                "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c899fb92427ae41e4649b94ca495991b7852b855",
                "accept": "*/*",
                "x-amz-date": "20230512T055934Z"
            }
        ],
        "statusCode": 403,
        "snap_details": {
            "label": "Get Job Status",
            "instance_id": "d11c3d70-02f8-45b4-a1fd-8f0a25539c15",
            "class_id": "com-snaplogic-snaps-rest-get",
            "build_tag": "main21015",
            "views": {
                "in": {
                    "input102": {
                        "count": 1
                    }
                },
                "out": {
                    "output101": {
                        "count": 5
                    }
                },
                "error": {
                    "error0": {
                        "count": 0
                    }
                }
            }
        },
        "original": {
            "original": {
                "response": {
                    "statusLine": {
                        "protoVersion": "HTTP/1.1",
                        "statusCode": 200,
                        "reasonPhrase": "OK"
                    },
                    "entity": {
                        "runId": "667c5da8694a408ba44c4b8b6566b282"
                    },
                    "headers": {
                        "content-length": "131",
                        "content-type": "application/json",
                        "date": "Fri, 12 May 2023 05:59:29 GMT",
                        "apigw-requestid": "Ey5VlnSoAMPSQ=",
                        "connection": "keep-alive"
                    }
                }
            }
        }
    }
]

Found this error message in CloudWatch logs: โ€œThe request for the IAM Authorizer doesnโ€™t match the format that API Gateway expects.โ€

Any idea why this is happening and how to handle this case?

0 REPLIES 0