What do I do if an executable file works properly in local tests but returns a permission denied error when it is executed in the Function Compute runtime environment?
Symptom
When I develop a function locally on the Windows operating system or the macOS operating system, the executable file works properly in local tests. However, when I deploy the function to the Function Compute runtime, the permission denied error is reported.
Possible causes
When you develop a function, you must package the code. Some compression tools on the Windows operating system and the macOS operating system may lose the attributes of a file or folder during packaging. After the file or folder attributes are lost, the file no longer has execute permissions. When the code is decompressed, deployed, and run again in the Function Compute runtime environment (Linux), the permission denied error occurs.
Solutions
Make sure that your compression tool preserves the Others permissions of the file or folder, such as the 755 permission. If your file or folder does not have such permissions, use one of the following methods to resolve the issue:
-
In the Function Compute console WebIDE, open a terminal window and run the command
chmod +x filenameto grant permissions on the file. For more information, see How to use WebIDE. -
When you develop a function locally, use the Linux operating system.