Use this checklist before creating or updating a CloudBase function.
- Decide whether this is an Event Function or an HTTP Function.
- Event Function:
exports.main(event, context), SDK/timer driven - HTTP Function:
req/res, listens on port9000
- Event Function:
- For Event Functions, confirm the code uses CommonJS:
require()for imports,exports.mainfor the handler. Do not useimportorexportsyntax — the runtime is CommonJS only. - Pick the runtime before creation and state it explicitly.
- For HTTP Functions, confirm
scf_bootstrapexists and the Node.js binary path matches the runtime (e.g.Nodejs18.15→/var/lang/node18/bin/node). - Confirm the function root path points to the parent directory, not the function directory itself.
- For HTTP Functions that need anonymous access, configure the function security rule with
managePermissions(action="updateResourcePermission", resourceType="function")after creation. Default rules reject anonymous callers withEXCEED_AUTHORITY. - If the request is really for a long-running container service, reroute to
cloudrun-development.
- Choosing the wrong function type and compensating later.
- Using ES Module syntax (
import,export) in Event Functions instead of CommonJS (require(),exports.main). - Mixing Event Function and HTTP Function handler shapes in the same implementation.
- Forgetting that runtime cannot be changed after creation.
- Mismatching the
scf_bootstrapNode.js binary path with the function runtime. - Forgetting to configure function security rules for HTTP Functions that need anonymous access.
- Treating Cloud Functions as the default answer for Web authentication.
- Function type and runtime are explicit.
- Packaging constraints are checked.
- The task is confirmed to be a function workflow rather than CloudRun.