Solving the Jira Attachment Corruption Mystery When Using Logic Apps

Recently, I encountered a task that seemed straightforward: using a Logic App to monitor a mailbox for new emails and then making an outbound HTTP Post to add an attachment to Jira. Simple, right? The plan was just two steps – monitor the mailbox and then integrate the attachment with the HTTP Post. But, as I discovered, things were not as simple as they appeared.

At first, everything seemed to work flawlessly. However, I noticed that when I viewed the attachment in Jira, files that weren’t plain text were corrupted. Believing it to be me just missing the content-type in the header, I added that into the headers payload, confident this would solve the problem. After consulting the Jira API documentation (How to Add an Attachment to a Jira Issue Using REST API) and verifying the native connector details on Microsoft’s documentation, everything seemed correct. Despite this modification, the issue persisted. Perplexed, I turned to Google for answers and stumbled upon a relevant StackOverflow post (Post Files Using HTTP Action – Encoding Problems). The suggested solution was to include it in the headers section, but I was already doing that! To further investigate, I wrote a simple C# function to accept the file via HTTP post and upload it directly to Jira, which worked perfectly. This outcome left me baffled.

Convinced that the problem might lie with the HTTP connector in Azure Gov, I contacted Microsoft support. After some back-and-forth, we finally identified the root of the issue: the content type needed to be in the body of the request, not in the headers!

For those using an HTTP post to trigger the Logic App instead of monitoring a mailbox, it’s important to add a ‘compose’ action with a triggerFormDataMultiValues expression before passing that output into the HTTP Post. This action should include the key name for your upload. In my case, it was labeled ‘file.’

I hope sharing my experience helps you avoid similar frustrations and saves you time in your future endeavors with Logic Apps!

Cheers

Logic Apps – GCC High SharePoint Connector – Maury Povich Edition

If you came across this post because you are trying to use the SharePoint connector with Logic Apps in GCC High…let’s continue below…

https://learn.microsoft.com/en-us/connectors/connector-reference/connector-reference-logicapps-connectors shows that SharePoint is supported in Azure gov, but that turned out to not be true.

After spending too much time trying to figure out how to make the SharePoint Connector log into GCC High, I popped a support ticket. Microsoft quickly told me that it indeed does not work in GCC High, but should be available this year (2023). I had to laugh because the support rep said it would be quicker to implement the fix into GCC High than update the documentation. LOL, I’ve been working with Azure for so long that statement is 100% true.

Workaround? Power Automate. That stinks because it requires a license, but it is what it is.