I tried to bundle fonts with my appwrite function and used File('assets/font/open-sans.ttf').readAsByteSync() to access it in my functions code, but it errored with Error: FileSystemException: Cannot open file, path = 'assets/font/open-sans.ttf' (OS Error: No such file or directory, errno = 2) .
i used appwrite cli to deploy functions.
Not sure if you can bundle custom assets, but have you added the assets in the pubspec.yaml?
Isn't assets in pubspec.yaml only available in flutter projects? This is a dart project
To be honest, I'm not sure about plain dart. I've only used dart with flutter so far. Regardless, I'll try to find any documentation about assets in dart projects
Can't seem to find anything so far, but have you tried using a URL for the assets?
So upload them on some CDN provider, and use the links to access them in your code.
That would be another way, won't the files be uploaded when I deploy functions and have access to them via file system? Every function is a docker container, is it?
Every function is a docker container, is it? Yes, it is. But its isolated from the outside world and don't have any persisted storage.
In case you do need to have some assets in your function and you unable to add them when you're deploying the function, Then, In this use case I will recommend to harnest the Appwrite storage module. and fetch the files from there when you function is statrting.
For dart, we compile the code into an executable and only transfer that executable to the runtime container:
You could see if there's a way to bundle assets into an executable and see how to reference it
I do think using Appwrite Storage is the best approach, though.
Recommended threads
- Helping in unblock my account
I deleted my Appwrite Cloud account that was linked via GitHub. Now I activated my GitHub Student Pack and want to sign up again using the same GitHub account, ...
- Not allowed permission to upsert a prese...
```js const presenceID = ID.unique(); setPID(presenceID); const presence = await presences.upsert({ presenceId: presenceID, status: "online"...
- Can't really use the S3 storage device
hi, I've linked my local MinIO Instance (it's just for testing, not for prod.) to my appwrite instance, when i'm uploading a file it's getting uploaded to the S...