I am working on a Forge app where the CustomUI part of the app needs to request a binary file from the Server side. The documentation is not 100% clear on this, but from my experiments it seems that a) the response object is not exposed, and b) I can only return strings or JSON from a function registered with the resolver.
I would like to be able to do something similar to res.sendfile() or res.pipe(), like the following pseudo code.
resolver.define('getSomething', async (req, res) => {
console.log(`req=${JSON.stringify(req)}`); <-- contains custom req object
console.log(`res=${JSON.stringify(res)}`); <-- is always 'undefined'
res.sendFile('<somefile>');
});
Encoding the binary value as a string works but I soon hit the size limit for the response and the value gets truncated.
My workaround at the moment is to use an external service (an AWS Lambda function) to generate the binary data and call that from my CustomUI front-end. However, my customers are not happy with that solution as it means that end-user data is processed outside the Forge/Atlassian environment.
My question is two-fold: firstly (question to the community), are there any other ways of doing this without a remote server outside the Forge environment. And secondly (question for Atlassian), are there any plans to start supporting binary data across the Forge Bridge?