Back

[SOLVED] Cloud Functions: Dart-2.17

  • 0
  • Functions
  • Cloud
StefanB
30 May, 2023, 12:12

I try to create a cloud function, where I have following folder structure:

TypeScript
.
|-lib/
   -main.dart
|-.appwrite/
|-pubspec.yaml
|-pubspec.lock

After manuel deployment via the appwrite console (cloud) I get this error:

TypeScript
Error: Couldn't resolve the package 'dart_appwrite' in 'package:dart_appwrite/dart_appwrite.dart'.
server.dart:37:27: Error: Method not found: 'start'.
          await user_code.start(request, response);

Where does user_code come from? Any other things I made wrong?

TL;DR
To solve the issue, make sure you have the 'dart_appwrite' package imported correctly in your `pubspec.yaml` file. Check your dependencies and ensure the package is included. Additionally, check that you have the correct version of the package specified. The error you're seeing is caused by a missing method 'start' in your code. 'user_code' is a reference to the Cloud Functions runtime code and is merged with your code during deployment. Ensure that your function code has a 'start' method defined. It is recommended to initialize your function code using the Appwrite CLI as it provides a good foundation.
Drake
30 May, 2023, 13:54

Your code gets merged with our runtime code. See https://github.com/open-runtimes/open-runtimes/blob/801c6a833aec4ec72fc8562b5dffba2b3967ed6b/runtimes/dart-2.17/server.dart#L37

I highly recommend using the Appwrite CLI to initialize your function code: https://appwrite.io/docs/functions#gettingStarted

This gives you a good working foundation to start with

StefanB
5 Jun, 2023, 04:44

[SOLVED] Cloud Functions: Dart-2.17

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more