Report this

What is the reason for this report?

How do you work locally on Functions ?

Posted on December 23, 2022
moad

By moad

What is the recommended way of working locally on a project meant to be used as a Function ? I don’t want to have to deploy every time, I want to be able to run (simulate how DO runs the Function), pass my args and be able to run tests before I deploy. How can I achieve this LOCALLY (without deploying anything to DO) ? Thanks



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey @driftingazurecrab,

Currently the recommended way of doing this is to use the development workspace using doctl as described here:

https://docs.digitalocean.com/products/functions/how-to/develop-functions/

Once the function is ready, then you deploy it to the App Platform. That way you will be sure that the function works the way that you want it to behave on the DigitalOcean infrastructure.

If this does not match your needs, the best thing to do to get your voice heard regarding this would be to head over to our Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.

https://ideas.digitalocean.com/

Hope that helps!

- Bobby.

I’ve found success by building my function locally as a single file, and using doctl sls watch <dir> to continually deploy the function when it changes. By skipping the remote build it’s a super fast deployment. Use doctl serverless activations logs --follow to see logs. Then I can develop on the remote function but it is fast, and feels like local development.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.