I want to read file which i have added in my cloud function what is the path in cloud so I can access it
if (request.path == "/read_proto") {
// Define the path to your .proto file
String filePath = '${io.Directory.current.path}/protos/test.proto';
try {
// Read the file as text
String content = io.File(filePath).readAsStringSync();
return response.json({
'path': request.path,
'proto': content,
});
} catch (e) {
return response.json({
'path': request.path,
'error': e.toString(),
});
}
}
"error": "PathNotFoundException: Cannot open file, path = '/usr/local/server/protos/test.proto' (OS Error: No such file or directory, errno = 2)"
I have dart function in following structure
dart_func
- lib/
- protos/
Cannot open file, path = '/usr/local/server/protos/test.proto
You won't be able to do this with go because your code is compiled and only the compiled binary is deployed
I show below function which is mention in templates
https://github.com/appwrite/templates/blob/main/dart/whatsapp_with_vonage/lib/utils.dart
I tried this way and got this error
"error": "PathNotFoundException: Cannot open file, path = '/usr/local/server/src/function/../protos/test.proto' (OS Error: No such file or directory, errno = 2)"
final protosFolder =
p.join(p.dirname(io.Platform.script.toFilePath()), '../protos');
final protosFilePath = p.join(protosFolder, "test.proto");
// Read the file as text
String content = io.File(protosFilePath).readAsStringSync();
Sorry I don't think that works
with go?
Sorry same with dart. Dart is also compiled
Okay, Thank you for your time.
I have one question, if I upload file in storage is there any way I can make it publically so I don't need to authenticate for file
https://cloud.appwrite.io/v1/storage/buckets/67cb873900041825c482/files/67cb877300353e5b4122/view?project=67ae34c00007ef221886&mode=admin
Sure. Configure the permissions for the bucket and possibly file
Yeah, I just figured it out. Thanks
For function, will it have support in future for read/add temp file when we deploy function?
Recommended threads
- Cloud function deploy stucks in processi...
Been trying for the last hours to deploy my function but for whatever reason, alwasy stuck on processing!
- One-time Cloud migration blocked by data...
Hi, Iβm blocked on a one-time migration from Appwrite Cloud to my self-hosted Appwrite instance. We already fixed the region issue, and the migration now corre...
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...