execSync
I don't understand, that runs the install command no?
Mine is in the build process so it's always there is the thought, why would that matter here?
no it's not.
and it needs to be done in the function
huh, oky
the build container is not the same container where your function gets exeucted. Also, the container can be removed and the nrecreated. That's why you always need to make sure to install the dependencies at runtime
interesting, lemme try this rq
see my issue with the one executor is a perfect example here
a PDF generation thus far has taken 2s, if 1000 people want one, I can't have it as an Appwrite Function no?
oof 9s to successfully generate one
if it always takes less than 30x, you can execute the function synchronously and they should all execute concurrently. However, it's probably best to execute the functions asynchronously
is that the 1st execution of the function?
yeah, oh true
the actual execution took 7 seconds I believe
including install
so lemme try again
oh yeah
so it's failing at creating the PDF in storage for some reason
fails here
log(`Ending Puppeteer timestamp (seconds): ${Date.now() / 1000}`);
const fileToUpload = InputFile.fromBuffer(pdf, `document_${new Date.now()}_upload.pdf`);
log(`File to upload created, trying to create file in Storage`);
const file = await storage.createFile(
"my_storage_id",
ID.unique(),
fileToUpload,
)
could it be that it's getting the wrong mimetype? it has no error that it's actually logging
not sure exactly...Maybe you can add a try catch.
hmm how about:
import { Readable } from "stream";
// ...
const stream = Readable.from(b);
const size = Buffer.byteLength(b);
const inputFile = InputFile.fromStream(stream, `document_${new Date.now()}_upload.pdf`, size);
So I got it to work doing exactly what you said yeah, forgot to update
[SOLVED] Using Puppeteer in a Function?
Recommended threads
- Feedback and Deployment Challenges with ...
Hello world!, I've been developing a project using FastAPI in Python, and I was considering deploying it through Appwrite Functions. However, I encountered a f...
- Bulk feature status
Hi there, I am using version 1.7.4 self hosted and wanted to use the bulk operations in a dart function. I saw that in the dart_appwrite sdk version 16.1.0 it ...
- CORS preflight returns 500 on Dart funct...
Hey everyone 👋 I’m running a Dart cloud function, Every time I respond to a preflight (OPTIONS) request, I get a 500 internal error, and the logs show: ```NoSu...