Back

Cloud-Function created with appwrite-cli produces errors (dart)

  • 0
  • Self Hosted
  • Functions
Rovolt
27 Nov, 2023, 18:26

Hello. I just updated my Appwrite server (1.4.13) and appwrite-cli (4.2.0). Still, if I create a cloud-function using appwrite init function --verbose for the dart runtime it produces sample code with errors. The "process" in the following code is unknown:

TypeScript
  final client = Client()
      .setEndpoint('https://cloud.appwrite.io/v1')
      .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
      .setKey(process.env.APPWRITE_API_KEY);
TL;DR
The user is experiencing errors with creating a cloud function using appwrite-cli in Dart. They have checked the documentation and believe there is an issue with the template code. They have also updated their Appwrite server and appwrite-cli, but the error persists. The error is occurring with the use of 'process.env' in the code. The user requests to create a GitHub issue for this problem. Solution: The user is advised to check the Dart version they are using and follow the correct syntax provided in the Appwrite documentation for environment variables. The user is also instructed to create a GitHub issue for further assistance with the commented code problem.
Drake
27 Nov, 2023, 19:11

what version of dart?

Drake
27 Nov, 2023, 19:13

oops fail...looks like that commented code is incorrect...Would you please create a github issue for that?

Drake
27 Nov, 2023, 21:01

thanks! so, as i mentioned, the syntax isn't right for dart. Please see our docs for the right syntax: https://appwrite.io/docs/products/functions/development#environment-variables

Rovolt
27 Nov, 2023, 21:04

Thank you! I don't know why I didn't get it working before since I checked the docs back and forth. Anyway, my fault.

Drake
27 Nov, 2023, 21:07

not your fault. the template/starter code is incorrect

Rovolt
27 Nov, 2023, 21:09

But your docs are correct and I saw it before but for whatever reason didn't get it work. Anyway, now everything makes sense πŸ™‚

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