If the cloud function execution returns a 405 error code, it typically involves a code issue. You can troubleshoot using the following steps:
1. Verify if the memory size allocated to the function is sufficient.
The configured memory size is 128MB, but the actual memory usage of the function exceeds this configuration, preventing the function from starting and causing a timeout.
Suggestion: Increase the memory configuration. You can log in to the Serverless Console, select the function, and increase the memory configuration on the Function Management page. As shown in the figure below:
2. Verify the listener port configuration.
The HTTP Server service within the container needs to listen on port 0.0.0.0:9000 (not 127.0.0.1:9000), rather than the host machine port outside the container.
Suggestion: Launch the container in your local environment and check if the service can start normally.
3. Check the permissions of the scf_bootstrap file.
Ensure that the permissions for the scf_bootstrap file are set to 755 or 777. Additionally, on Linux, you can try executing the ./scf_bootstrap command. If the output is similar to the following, it is likely in DOS format:
Suggestion: Open the scf_bootstrap file with the vim editor and execute the :set ff command to check the file format, verifying whether it is in UNIX format. If not, you can use the :set fileformat=unix command to change it to UNIX format.
4. Check the read and write permissions of other directories.
Only the tmp directory is writable, all other directories are read-only.
Suggestion: To troubleshoot locally, you can use the docker diff command to identify modified files.
5. Check for overwriting in the tmp read-write directory within the container image.
Upon startup, the container will overwrite the tmp directory, meaning the contents within the tmp directory of the original container image will be replaced. Files that the startup depends on should not be placed in the tmp directory.