How do you work locally on Functions ?

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

Submit an answer

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!

Sign In or Sign Up to Answer

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.

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.

Bobby Iliev
Site Moderator
Site Moderator badge
December 23, 2022

Hey @driftingazurecrab,

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

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.

Hope that helps!

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up