All Products
Search
Document Center

Function Compute:FAQ about Serverless Devs

Last Updated:Jul 19, 2023

This topic provides answers to commonly asked questions about Serverless Devs.

How do I configure the s.yaml file?

For more information about YAML specifications, see YAML specifications.

What do I do if an exception occurs but no error message is reported when I use Serverless Devs?

You can perform the following steps to troubleshoot the issue:

  1. Run the npm install @serverless-devs/s -g command to update Serverless Devs.

  2. Run the s clean --all command to delete redundant files.

  3. Run the rm -rf .s command to remove the .s file from the directory.

  4. Run the s -v command to view the version of Serverless Devs.

    If no response is returned after you run the command, the local Node.js runtime may be abnormal. You must reinstall Node.js 12 or a later version.

If the issue persists, join the DingTalk group 11721331 to contact technical support. Provide the {s-home}/logs/{TraceId}.log log file and the s.yaml file to facilitate troubleshooting.

The following figure provides an example on how to obtain {s-home} and {TraceId}.checks-s-home

What do I do if I want to use local configurations when I deploy the code?

You can select use-local when you run the s deploy command, or run the s deploy -y --use-local command.

Does Serverless Devs support multi-region deployment?

Yes, multi-region deployment if supported. For more information, see Multi-region deployment of Serverless Devs.

How do I perform local debugging on a function?

  • If your runtime is not a custom runtime but a built-in runtime of Function Compute, such as Node.js and Python, we recommend that you use the local invocation method of Serverless Devs for debugging. For more information, see Local commands.

  • If your runtime is a custom runtime, you can start a server code debugging process based on common development practices.

    Note

    For custom runtimes, the s local invoke command can initiate local execution of functions. However, breakpoint debugging is not supported.

How do I use the .fcignore file?

When you upload dependencies in a project to the Apsara File Storage NAS (NAS) file system to deploy a large code package, you can use the .fcignore file to exclude specific files.. For more information, see Common tips.

How do I specify to deploy and call a specific function when multiple functions are defined in the s.yaml file?

In the s.yaml file, a service may contain multiple functions. If you want to deploy or call only one of the functions, you can specify the function name when you run the following commands: s deploy, s local start, and s local invoke. In the s.yaml example file of the following figure, only the helloworld function is deployed after you run the s helloworld deploy function.

muti-functions

What do I do if the "connect ENOENT /var/run/docker.sock" error is reported when I run the s local or s build command?

Error message

Sample error message:

Project xxx failed to execute:

ERROR:

connect ENOENT /var/run/docker.sock

Solution

If Docker commands can be run as expected on an on-premises machine but the s local or s build commands cannot be run by Serverless Devs, perform the following steps to resolve the issue:

  1. Check whether the /var/run/docker.sock file exists.

    1. Run the following command to check whether the file exists. If the file exists, skip the following step. If the file does not exist, perform the following step.

      ll /var/run/docker.sock
    2. Configure a soft link to the /var/run directory.

      ll ~/.docker/run/docker.sock
      ln -s ~/.docker/run/docker.sock  /var/run/docker.sock
  2. Check whether the Docker client is started.

    To run the s local or s build command in Serverless Devs, you must start the Docker client. Make sure that the Docker client is started.