-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Bug Report: cloud functions with Dart 2.14 runtime not working #2353
Comments
@Silfalion hi, I'm unable to reproduce the error using your guidelines. Might be something to do with your system. Please provide logs of your docker console as well as the code used. I'm using the following code import "dart:io";
import "package:dart_appwrite/dart_appwrite.dart";
void main() { // Init SDK
Client client = Client();
client
.setEndpoint(Platform.environment["APPWRITE_ENDPOINT"]) // Your API Endpoint
.setProject(Platform.environment["APPWRITE_PROJECT"]) // Your project ID
.setKey(Platform.environment["APPWRITE_SECRET"]) // Your secret API key
;
Storage storage = Storage(client);
//Future result = storage.getFile(fileId: '[FILE_ID]');
print(Platform.environment["APPWRITE_FUNCTION_ID"]);
print(Platform.environment["APPWRITE_FUNCTION_NAME"]);
print(Platform.environment["APPWRITE_FUNCTION_TAG"]);
print(Platform.environment["APPWRITE_FUNCTION_TRIGGER"]);
print(Platform.environment["APPWRITE_FUNCTION_ENV_NAME"]);
print(Platform.environment["APPWRITE_FUNCTION_ENV_VERSION"]);
// print(result['$id']);
print(Platform.environment["APPWRITE_FUNCTION_EVENT"]);
print(Platform.environment["APPWRITE_FUNCTION_EVENT_DATA"]);
} |
@lohanidamodar Hey, I was able to use your code without problem but I still get the same issue. Here is the log:
The code is too long to paste here but this is the beginning of it:
But it still doesnt print that. |
@Silfalion Were you able to get the output with my code or not? |
I was. It outputted normally. |
@Silfalion Does also simple hello world work? If not can you provide exact hello world code that did not work? |
Per the code I showed you now, it doesn't. Even though it was the very first line on the main function, it didn't print it. |
Nothing on STDOUT and nothing on STDERR. |
It's the one I copied above. The whole project is a little bit too big to copy over here. |
@Silfalion There might be other issues in the code. It's not a simple hello world function, it has lots of imports and other codes. Try to run your code normally in your local environment without using Appwrite runtime to make sure the code is working as expected. |
It works without issues with both the dart 2.13 and 2.14 environments. |
Then may be try to run locally using our runtime docker image? |
An error spawns every now and then though, just got it now:
But the function is added normally even then. |
Sorry, can you explain? It's I meant I tried. |
I mean run locally using the Docker image of our runtime, instead of local on your computer. If you already ran with our docker image successfully then let me know. |
When does this error come?lo
Running the installation again should update it |
Ah yes. That's what I did, I don't have a copy of the server locally. I used both the 2.13 and 2.14 runtime docker images locally and they worked without issues. |
When creating a new tag through appwrite cli. But it happens sporadically, with no exact pattern. Does the appwrite cli version may be causing that? I think I'm still running the previous version. If you think it is, can you direct me on how to update it. |
I tried just now to run the same function with an empty file containing only a main and a print and it still didn't show anything. What does that mean lol? Is it possible the other containers are causing this? If you noticed, there are 20 containers running, but I don't have that many cloud functions. It looks like they're not being disposed of. |
Correcting my last message. It does work where there nothing else but the print message. Will try to look for what else is causing it. |
@lohanidamodar Ok, I think I found the issue. The problem is when importing files from the folder, it just exits then. If the folder is named project then:
Will cause it to exit instantly. This didn't happen with dart 2.13 although I still an issue of the function exiting instantly in that version, but idk if its related. Basically the solution would be to put everything in the same file but I didn't try it yet. |
Tested again and I have a private repository that's part of the dependencies when I delete its imports it works. With the just printing stuff, nothing else. |
@lohanidamodar sorry, is there a timeout for the functions to stops? What I mean is that there is a future that also pushes the function to exit. Multiple future all connecting to appwrite. On each function execution you can find a different outputs. Either the first future finishes then the function stops or it can go until the third but doesn't go beyond, it's like the function is forced to exit at that point, is this normal? I can open a separate issue if this seems unrelated. |
@Silfalion under the function's setting there is a |
@TafadzwaD already increased it to the limit of 900. What did the trick temporarily for now is to add prints to the functions with a future return type. It seems like that the code really awaits until it completes. |
Apparently the issue is dart 2.14 not liking imports of libraries not from pub.dev. deleting the imports makes the code execute. But I can't work without the package. Any idea about this please? |
Which version of AppWrite are you on?? |
0.11 |
@lohanidamodar Kindly assist on this one.. |
@TafadzwaD I think he may be waiting for the release of version 0.12 to solve everything in one go. |
@Silfalion Maybe that might be case.. So hang in there buddie 😅😅😅 |
Will do haha Thank you very much for your assistance! |
You're most welcome 😀 |
:) So did some more testing, tested on a frensh install of 0.11 and on a fresh install on 0.12 on two different machines. And both give the same result. Thanks to drake we found something. When executing into the function's container and running dart bin/main.dart and it returns Killed. I'm very lost at this behavior. |
@Silfalion Here is my test result.
However, I also suggest few things
|
On point recommendations. Was thinking about it since I need quicker responses for this function in particular. Will give them a try and see how it goes. Thank you so much. |
Closing this issue for now, we can reopen it if needed. |
👟 Reproduction steps
👍 Expected behavior
Prints hello world
👎 Actual Behavior
empty stdout and stderr
🎲 Appwrite version
Different version (specify in environment)
💻 Operating system
Linux
🧱 Your Environment
uses 0.11 version
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: