0
votes

I have an ASP.Net handler that returns a PDF report. I want the Azure Logic App to request the file and then add it to an e-mail as an attachment.

When I try to do this through an HTTP request I get the following error:

BadRequest. Http request failed as there is an error: 'Error while copying content to a stream.'

If I make the request with a browser I get a HTTP 200 response and it works. See request/response headers from chrome and fiddler.

I'm sure I could solve this with an Azure Function to get the file blob and pass it to the e-mail stage but it appears in the documentation that Logic Apps can handle streams and base64 encode. Am I missing something here?

chrome network tab

1
Is your file stored as a blob?George Chen
I don't think logic app supports it (to be confirmed by a logic app expert) . In the past I managed to work around this problem by sending the file as base64 encoded body then the logic app will pick up the file content correctly.Thomas
@GeorgeChen the response streams the file. I was just referring to the 'Body' as blob.Markive

1 Answers

1
votes

I tried with the following a static result in an HTTP request to mimic the HTTP request/stream as much as possible. I guess it comes down to that you need to design the body of the stream in a way the includes content and content-type like I did below with my mockup HTTP request

static request

pdf content

static request setup1

content-type: application/pdf and application/octet-stream worked static request setup2

Send and email action:

enter image description here

Sent email result

Outlook result:

enter image description here