I have a Forge app with a Web Trigger that wants to attach a file to an issue. I’m aware of the binary files get corrupted issue, but that’s OK because I’m only dealing with text files.
I think this should work:
const form = new FormData();
form.append("file", Buffer.from("Hello World!"), {filename: "sample.txt"})
const response = await api.asApp().requestJira(route`/rest/api/2/issue/AWS-12/attachments`, {
method: 'POST',
body: form,
headers: {
'Accept': 'application/json',
'X-Atlassian-Token': 'no-check'
}
});
But, I get TypeError: function () { [native code] } could not be cloned.
This has come up before and generally gets referred to this issue, but that’s the binary corruption issue, where as this is a run time error.
Reading through posts it seems like some folks have been able to get it to work on the Custom UI side, but Web Triggers are not that.
If I can’t get this to work, I’m going to have to use Connect, but it would be nice to get a definitive answer before I do.
Thanks!