Back

Error deploying function to Appwrite cloud

  • 0
  • Functions
  • Cloud
malomz
17 Sep, 2023, 19:26

Tried deploying a sample serverless function using the dart runtime and i get this error

TypeScript
Docker Error: Info: Compiling with sound null safety
server.dart:37:27: Error: Method not found: 'start'.
          await user_code.start(request, response);
                          ^^^^^
Error: AOT compilation failed
Generating AOT kernel dill failed!
TL;DR
User is experiencing an error while deploying a function to Appwrite cloud. They have tried deploying using the Appwrite CLI and manually uploading a gzip file, but encountered the same error for both methods. The user shares a sample function code in Dart and provides the specific error message they received, which states "Docker Error: Info: Compiling with sound null safety." Solution: The user should make sure they are using the correct version of the Appwrite CLI (v2.0.2) and follow the deployment instructions provided in the Appwrite documentation (https://appwrite.io/docs/functions-deploy). They should also check if their
malomz
17 Sep, 2023, 19:27

Sample function code below:

TypeScript
import 'dart:async';
import 'package:dart_appwrite/dart_appwrite.dart';

// This is your Appwrite function
// It's executed each time we get a request
Future<dynamic> main(final context) async {
  // Why not try the Appwrite SDK?
  //
  // final client = Client()
  //   .setEndpoint('https://cloud.appwrite.io/v1')
  //   .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
  //   .setKey(process.env.APPWRITE_API_KEY);

  // You can log messages to the console
  context.log('Hello, Logs!');

  // If something goes wrong, log an error
  context.error('Hello, Errors!');

  // The `req` object contains the request data
  if (context.req.method == 'GET') {
    // Send a response with the res object helpers
    // `res.send()` dispatches a string back to the client
    return context.res.send('Hello, World!');
  }

  // `res.json()` is a handy helper for sending JSON
  return context.res.json({
    'motto': 'Build Fast. Scale Big. All in One Place.',
    'learn': 'https://appwrite.io/docs',
    'connect': 'https://appwrite.io/discord',
    'getInspired': 'https://builtwith.appwrite.io',
  });
}
btme0011
17 Sep, 2023, 19:49

https://appwrite.io/docs/functions-deploy

Here is a document on different ways to deploy a function. Can you specify how are u trying to deploy?

malomz
17 Sep, 2023, 19:53

Oh my bad....

I have tried deploying using the Appwrite CLI and Manually by uploading a gzip file but got the same error for both method

Drake
17 Sep, 2023, 21:28

This is for Appwrite v1.4. Cloud is on 1.1.2 for now. I suggest installing v2.0.2 of the Appwrite CLI and appwrite init function to create functions and appwrite deploy function to deploy

malomz
17 Sep, 2023, 22:36

Oh okay

Thanks @Steven

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