Power Automate Create Report Error

111
2
2 weeks ago
SethStark1
New Contributor II

I have a Power Automate flow that is triggered with the Survey123 "When a survey response is submitted" trigger. Part of that flow is the creation of a report, then the report is uploaded to OneCloud and attached to an email (see attached screenshot of the flow). This flow has been run hundreds of times, the vast majority of them have been successful; however, seemingly randomly, the flow will fail and it always fails with an error message of "A value must be provided for source path." (see attachment for failed flow run).

The Create report step reports that it has succeeded (green check mark), but when the Output of the Create Report step is examined, the jobStatus is "esriJobFailed" (see screenshot of output message).

It seems that there are two errors in the Create Report that can be the cause. Either 

Layer specified by featureLayerUrl does not exist or is not accessible.503: An error occurred.
 
The specified layer does exist, I'm not sure why it would be inaccessible one second and accessible the next.
 
OR
 
An error occurred when querying data from the feature layer. 503: An error occurred.
 

So, it seems to me that there is an error occurring when creating the report which in turn prevents the file (which is never created) from being uploaded and then attached to the email. This error is not consistent, because the flow will run successfully multiple times and then fail, then run successfully, then fail (see run history screenshot). Any idea what could be causing this? 

 

An example of the full text of the Create Report output body:

{
    "statusCode": 200,
    "headers": {
        "Via": "1.1 4a3448a83573e51d340356257951f57a.cloudfront.net (CloudFront)",
        "ETag": "W/\"35d-W2a32/eeMDN25fwxkZLUqn+3b4c\"",
        "Vary": "Origin,Accept-Encoding",
        "X-Frame-Options": "SAMEORIGIN",
        "Strict-Transport-Security": "max-age=63072000; includeSubdomains; preload",
        "X-Cache": "Miss from cloudfront",
        "X-Amz-Cf-Pop": "DEN52-P3",
        "X-Amz-Cf-Id": "eK-92homNDWOxO1G92luIBlLKYh1TuBlPTBidnWLgqZQ203UD1gqTw==",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "x-ms-apihub-obo": "false",
        "Date": "Tue, 07 May 2024 15:23:27 GMT",
        "Content-Length": "861",
        "Content-Type": "application/json"
    },
    "body": {
        "jobId": "5bd9af72eb6b4510b0ce832e17bbdeda",
        "jobStatus": "esriJobFailed",
        "jobStatusInfo": {
            "detailedStatus": "prepareFailed",
            "startTime": 1715095398525,
            "progress": 0
        },
        "submitted": 1715095398325,
        "completed": 1715095405088,
        "resultInfo": {
            "title": "Weed Mowing Work Order (9-04-12-11-181-025-05-7-24)"
        },
        "inputInfo": {
            "jobType": "createReport",
            "parameters": {
                "queryParameters": {
                    "objectIds": "1531"
                },
                "templateItemId": "09c1a62a967b4ccfbca7f050d25ca738",
                "surveyItemId": "REDACTED",
                "portalUrl": "https://www.arcgis.com",
                "outputFormat": "pdf",
                "outputReportName": "Weed Mowing Work Order (9-04-12-11-181-025-05-7-24)"
            }
        },
        "messages": [
            "An error occurred when querying data from the feature layer. 503: An error occurred."
        ]
    }
}
0 Kudos
2 Replies
RobertAnderson3
MVP Regular Contributor

I've run into similar issues here and there, this one happened last night then a few minutes later re-ran and it worked, no rhyme or reason.

{"error":{"message":"Layer specified by featureLayerUrl does not exist or is not accessible.500: Unauthorized access","code":"102","details":["500: Unauthorized access"]},"success":false}

I have set up my create report in a loop to try a couple times to try and catch any hiccups the servers throw, and I think unfortunately that's what this is. I think it helps, though I do never think to go back and check the ones that work.

I set a variable and capture the jobStatus and then use it for a condition to run until succeeded, but I set it to only try like 10 times so it's not stuck for forever. I also have it set up in a Scope (Try) so if it fails it sends me an email with the error message.

RobertAnderson3_0-1715180317592.png

 

0 Kudos
abureaux
MVP Regular Contributor

Ya, the Create Report step has a tendency to randomly fail sometimes.

You need error handling to avoid any odd stoppages. One excellent method is suggested by @RobertAnderson3. I also have a guide that starts touching on this concept here.

If you can generate a report form the Surveys Site, the Create Report step in Power Automate should also work.

0 Kudos