Rank 2: Process
I have an error compiling a cloud function with Dart 3.1
Here is some information :
Function is in auto-deploy from Github on a self-hosted instance
".env" has these two lines and Dart 3.1 is correctly detected
_APP_FUNCTIONS_RUNTIMES=node-16.0,php-8.0,python-3.9,ruby-3.0,dart-3.1
_APP_FUNCTIONS_ENVS=node-16.0,php-7.4,python-3.9,ruby-3.0,dart-3.1
here is my "pubspec.yaml"
name: starter_templateversion: 1.0.0
environment: sdk: ^3.1.0
dependencies: dart_appwrite: ^10.0.0
dev_dependencies: lints: ^3.0.0here is my dart code in "lib/main.dart" code
import "dart:async";import "dart:io";import "package:dart_appwrite/dart_appwrite.dart";
Future<dynamic> main(final context) async { final Map<String, String> envVars = Platform.environment; final client = Client() .setEndpoint("https://backend.diskmth.fr/v1") .setProject(envVars["APPWRITE_FUNCTION_PROJECT_ID"]) .setKey(envVars["APPWRITE_API_KEY"]); context.log("Hello, Logs!"); context.log(envVars); context.error("Hello, Errors!"); if (context.req.method == "GET") { return context.res.send("Hello, World!"); } return context.res.json({ "motto": "Build like a team of hundreds_", "learn": "https://appwrite.io/docs", "connect": "https://appwrite.io/discord", "getInspired": "https://builtwith.appwrite.io", });}and finally here is the error I get during the deployement
Docker Error: Preparing for build ...Resolving dependencies...+ async 2.11.0+ boolean_selector 2.1.1+ collection 1.18.0+ matcher 0.12.16+ meta 1.11.0+ path 1.8.3+ pub_semver 2.1.4+ pubspec 2.3.0+ quiver 3.2.1+ source_span 1.10.0+ stack_trace 1.11.1+ stream_channel 2.1.2+ string_scanner 1.2.0+ term_glyph 1.2.1+ test_api 0.6.1+ uri 1.0.0+ yaml 3.1.2Changed 17 dependencies!found user package starter_templateadded user package as dependency to server.Updated server import of user codeBuilding ...Resolving dependencies...+ async 2.11.0+ collection 1.18.0+ dart_appwrite 10.0.0+ http 1.0.0 (1.1.0 available)+ http_parser 4.0.2+ meta 1.11.0+ path 1.8.3+ shelf 1.4.1+ source_span 1.10.0+ stack_trace 1.11.1+ starter_template 1.0.0 from path /usr/local/build+ stream_channel 2.1.2+ string_scanner 1.2.0+ term_glyph 1.2.1+ typed_data 1.3.2Changed 15 dependencies!Compiling ...src/server.dart:5:8: Error: Error when reading '../build/lib/lin/main.dart': No such file or directoryimport 'package:starter_template/lin/main.dart' as user_code; ^src/server.dart:115:25: Error: Method not found: 'main'. user_code.main(context) ^^^^src/server.dart:125:38: Error: Method not found: 'main'. output = await user_code.main(context); ^^^^Error: AOT compilation failedGenerating AOT kernel dill failed!If you have any ideas as to why I'm getting this error, I'd love some help.
Thanks in advance