cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndresGallegos
Regular Visitor

Error during Approval step; InvalidRequestContent

Hi all,

 

I've been building flows for my company for a while now.  They have been mostly really simple approval flows for different processes. 

The flow I'm having problems with gets triggered when a new item is created in a Sharepoint List.  It's supposed to get the attachments from the record and start an approval process.  I have this same process working in another flow with no issues.

I use the approach to get contents and attach them to the approval from this post How to get Get Attachment into power automate - Microsoft Tech Community

 

I'm getting this error during the Start and wait for an approval step on my flow:

The request failed. Error code: 'InvalidRequestContent'. Error Message: 'The request content was invalid and could not be deserialized: 'Unexpected character encountered while parsing value: {. Path 'attachments[0].Content', line 1, position 1002.'.'.

 

From the error I gather that there's something going on with the attachments (variable) but I'm not sure where to go from here.

I use the same set of steps to get attachments and content on both flows, but only one of them is working.  I also tried testing with the same attachment on the 2 different flows just in case but same result.  Here are 2 snips of the different flows.  One fails and the other one doesn't.

 

Flow 1 with an errorFlow 1 with an errorFlow 2 with no errorsFlow 2 with no errors

 

 

Any help on how to understand the error itself and troubleshoot it is greatly appreciated

 

**Edit**

Here's a couple of snips on the steps to get attachments, apply to each, start and wait for approval:

Get atttachmentsGet atttachmentsApply to eachApply to eachStart and wait for an approvalStart and wait for an approval

1 ACCEPTED SOLUTION

Accepted Solutions
AndresGallegos
Regular Visitor

I ended up re-creating the flow and tried a few different things along the way.  A couple of things I learned from this whole ordeal...

  • I'm not sure if this is what was causing the issue in the first place but the old flow that was failing shows a different setting on the trigger step (even though it's supposed to be the same step 'When an item is created on SP').  I checked a few of my other flows and none of them have this setting.  Not sure if anyone can shed some light on this:
    Left side shows the setting on the old flow that was failingLeft side shows the setting on the old flow that was failing
  • When re-creating the flow I tried using 'ContentBytes' but it still didn't work.  Neither did  'Content'.  For some reason it only worked with 'content' which is how I have it in the other working flow

 

@Pstork1 - All the attachments are PDF files, but there are no restrictions in case someone tried to submit a different format.  I thought get attachment content step would work for any format, is this not the case?

View solution in original post

7 REPLIES 7
Pstork1
Dual Super User III
Dual Super User III

Would you show us what the Apply to each and approval configuration looks like in the one that fails?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi, thank you for looking into this.  I've added some snips to the original post.

I'm not sure why the one works with it set up that way.  But in your attachment array it should be 'ContentBytes': not 'Content':.  I've seen that cause the array to fail in the past.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

I tried changing from 'Content' to 'ContentBytes' and now getting a different error.  I found this post suggesting that any attachments in the approval step don't work with 'ContentBytes' only with 'Content' (if I understood correctly) Solved: Power Automate approval with Attachments - Power Platform Community (microsoft.com)

 

Here are the snips showing the update in the flow and new error:

Update w/ContentBytesUpdate w/ContentBytesNew errorNew error

 

I'm going to try and create the flow from scratch again...

You are correct.  AS stated in that thread its a bug.  It should be contentBytes, but something in the approval action was coded wrong.  So we are back to the original problem.  What kinds of files are in the attachments?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
AndresGallegos
Regular Visitor

I ended up re-creating the flow and tried a few different things along the way.  A couple of things I learned from this whole ordeal...

  • I'm not sure if this is what was causing the issue in the first place but the old flow that was failing shows a different setting on the trigger step (even though it's supposed to be the same step 'When an item is created on SP').  I checked a few of my other flows and none of them have this setting.  Not sure if anyone can shed some light on this:
    Left side shows the setting on the old flow that was failingLeft side shows the setting on the old flow that was failing
  • When re-creating the flow I tried using 'ContentBytes' but it still didn't work.  Neither did  'Content'.  For some reason it only worked with 'content' which is how I have it in the other working flow

 

@Pstork1 - All the attachments are PDF files, but there are no restrictions in case someone tried to submit a different format.  I thought get attachment content step would work for any format, is this not the case?

View solution in original post

You are correct it should work for any file type but you never know.  It should definitely work for PDFs.  I've never seen the code on the trigger either.  Maybe that was from an older format.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (69,097)