Since the storage system of each client is different, the saving is done in the backend instead of in the appwrite function
What's client platforms do you have? What backend are you referring to?
These are management applications made in vue3 in the frontend part and Typescript in the backend part.
Clients have a billing application and the appwrite function is responsible for collecting the invoice data and creating the pdf document
So you're using nuxt with a server side backend?
What's calling the function? The browser or the server side back end?
Yes, i dont use nuxt only vue but its the same.
I call the function in the server side
so if your function puts it in storage, your server can use storage.getFileView()
to get the file buffer
Yes, I understand the procedure. Store the file and facilitate access to download it via appwrite storage.
The question to increase the response size was to have a temporary solution since the file system will take some time to implement it in several clients.
Thanks for your time and help @Steven I apreciate your job and dedication to this awesome plattform 🙂
what file system???? There is no file system involved in what i am suggesting
I'm sorry, maybe I didn't explain well
What I mean is that it will take me some time to change the implementation on the server side since there are several clients.
Instead of capturing a buffer in the return of the function, now it should capture something lighter like the url of the file to be able to download it previously on the server side.
it will take time to make any sort of change to the server side code?
Yes
For the moment I have managed to solve the problem temporarily, reducing the size of the pdf before returning it.
because the change should be something like:
const execution = functions.createExecution('[FUNCTION_ID]');
const buffer = execution.response;
to:
const execution functions.createExecution('[FUNCTION_ID]');
const fileId = execution.response;
const buffer = storage.getFileView('[BUCKET_ID]', fileId);
Would there be a simple way to programmatically delete the files after x time?
create an Appwrite Function that runs on a schedule to find and delete files
great
anyways...changing the limit can be complex because it's limited to 1MB in the database: https://github.com/appwrite/appwrite/blob/96fa7362f3f045c242758b7e42469e982a3039bf/app/config/collections.php#L2691-L2701
and the data from the runtime is trimmed: https://github.com/appwrite/appwrite/blob/96fa7362f3f045c242758b7e42469e982a3039bf/app/executor.php#L578-L580
that's why using storage is a much better alternative
Yes, I noticed that when trying to parse the response JSON it indicated that it was not valid. I saw that feature on github where you guys talked about: https://github.com/appwrite/appwrite/issues/3434
The change is simple but since I have it implemented in several projects I will need to take some time to test it in development and then upload it to production.
But we agree that the file system is the best option.
makes sense. thanks for the insight 👍🏼
Thanks 4 all @Steven
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...