Skip to content
Back

easy way to debug functions

  • 0
  • Functions
rohan
26 Jul, 2023, 08:53

Hi, I want to debug the appwrite functions before deploying it.. how do i test it locally?

TL;DR
The user is asking how to debug Appwrite functions before deploying them and how to test them locally. A suggestion is made to use a local server.js file to mimic the OpenRuntime environment. A GitHub issue and a GitHub example are provided for more information. Another suggestion is to use open runtimes containers for different testing methods. It is recommended to test the functions by deploying them in a separate instance before deploying to the final production instance. The user is advised that complex functions should be tested before deployment.
D5
26 Jul, 2023, 09:39

The best way is probably testing them by directly deploying them

rohan
26 Jul, 2023, 12:24

complex functions are requried to be tested before

D5
26 Jul, 2023, 12:27

You can have a separate instance to test it

D5
26 Jul, 2023, 12:27

I mean, a local instance in your computer and then you deploy them to your final publicly available instance, for example, Appwrite cloud

D5
26 Jul, 2023, 12:28

Not sure if there's another way to debug/test functions without deploying them in any instance

rohan
26 Jul, 2023, 12:28

but thats not a good way to test.. is there anyway to test the node version of cloud function to test locally direct like executing a js function

D5
26 Jul, 2023, 12:31

Why not, I think I didn't explained it well. You have an instance installed in your computer, and you test and deploy the function in such instance firstly to test it. Then after testing, you deploy it to the final/production instance

D5
26 Jul, 2023, 12:32

Maybe with open runtimes you could do some test

joeyouss
26 Jul, 2023, 14:17

Hi, since you did not mention SDK, I am going to drop some relevant links for better understanding

joeyouss
26 Jul, 2023, 14:19

You can try an open runtimes container as well if you are seeking a different method https://github.com/open-runtimes/open-runtimes/tree/main/runtimes/node-18.0

(please see for your own desired runtime)

D5
26 Jul, 2023, 14:28

He mentioned: node SDK

Binyamin
26 Jul, 2023, 14:52

For production test the best would be as @D5 said.

For local testing, you might also want to upvote this https://github.com/appwrite/appwrite/issues/5425 And you can see here some example for how to https://github.com/byawitz/roadmapper/blob/main/functions/getGitFeatures/local-server.js

In general using that file will let you to mimic the OpenRuntime environment

rohan
26 Jul, 2023, 16:53

i guess this is what i wanted thanks... it will be easy to run the local-server.js to test first and then deploy

joeyouss
26 Jul, 2023, 18:34

sorry, might have missed that : )

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