Symptoms

When I develop a function on an on-premises machine that runs the Windows or macOS operating system, the executable file is normally executed in on-premises testing. However, when I deploy the function to Function Compute and execute the executable file in a runtime environment in Function Compute, the permission denied error message is returned.

Causes

You need to package code when you develop the function. When some compression tools compress a file in the Windows or macOS operating system, the attributes of the file or folder may be lost. The file is no longer executable because the attributes of the file or folder have been lost. When the code is extracted, deployed, and then run in a Linux runtime environment in Function Compute, the permission denied error message is returned.

Solutions

Make sure that your compression tool retains the Others permissions such as the 755 permissions on the file or folder. If no similar permissions on your file or folder exist, you can use one of the following methods to resolve the problem:
  • Run the chmod +x File name command to grant the permissions on the file in the Linux runtime environment in Function Compute.
  • Develop functions on an on-premises machine that runs the Linux operating system.